Posts have a title and an array of users who have liked the post:
{
"title" : "Example Title",
"likes" : ["User 1", "User 2", "User 3"]
}
I am displaying the "posts" like this:
<div ng-repeat="post in posts">
<h1>{{post.title}}</h1>
<span ng-show="doesLike(post.likes)">Liked already</span>
<span ng-hide="doesLike(post.likes)">Like this post</span>
</div>
and I have a function in my controller doesLike() that returns true or false depending on whether the current user's username is in the array that is passed to the function. While this approach works can I achieve the same thing using a filter as I think this would be cleaner?