Angularjs: Using 'track By' Disables Filter In Ng-repeat
Since I implemented track by into ng-repeat, it prevents my filter from executing. For example, track by $index works like a charm but when I try to add an input field to search my
Solution 1:
You need to add track by
at the end of the expression. See this working plunkr.
Code:
<divng-repeat="message in messages.collection | filter : searchText track by $index"><p>{{message.text}}</p></div>
Solution 2:
Please rather try to track by on the filter
message in messages.collection | filter : searchText track by $index
As suggested on https://docs.angularjs.org/api/ng/directive/ngRepeat
Best
Post a Comment for "Angularjs: Using 'track By' Disables Filter In Ng-repeat"