I have an ngRepeat directive that is filtered as:
<li ng-repeat='item in items | filter:searchTerm as filteredItems'>{{item.name}}</li>
I am tring to access the filteredItems in my controller like $scope.filteredItems but I'm getting an undefined. How should I solve this?
I have nested controllers. Is the problem with $scope?
My controllers are something like this in my view:
<div ng-controller='MainController'>
<div ng-controller='FilterController'>
<li ng-repeat='item in items | filter:searchTerm as filteredItems'>{{item.name}}</li>
</div>
</div>
I'm trying to access $scope.filteredItems in FilterController.
<li ng-repeat='item in (filteredItems = items | filter:searchTerm)'>{{item.name}}</li>, but not sure that this works, also this code can addfilteredItemsnot in main scope, but in ngRepeat own scope