Angular - how can I watch a filter result array for changes from the controller

旧巷老猫 提交于 2019-12-12 18:02:32

问题


I have a filter that filters with some criteria through a ng-repeat list.

How could I watch the RESULTING array that is made by the filtering service for changes INSIDE the controller?

The full Question and description is here Angular factory filter - Can't get data passed to the filter in the first answer.


回答1:


What about piping your data through a local method like this ?

<li ng-repeat="item in catchData((items|cut:max))">...</li>

I plunked a full example here http://plnkr.co/edit/2L25wdB6S8GG659H4jPw?p=preview



来源:https://stackoverflow.com/questions/18775011/angular-how-can-i-watch-a-filter-result-array-for-changes-from-the-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!