I can't find a way to filter my list only by its title.
My list is an array made of objects like this :
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
I also have an input field inside my html file
<input type="search" id="search" class="form-control" ng-model="search.title" placeholder="Search by title">
This field is being watched in my controller
$scope.$watch('search.title', function(val) {
$log.log($filter('filter')(vm.posts, val));
});
And that's where I want to filter my vm.posts (my list of the objects i mentioned above) only by its title. Instead, it is filtered by its whole object, both body and title part. I know how to do it in html file by filter:search, but I have no idea how to do this inside a controller.