0
當我使用ng-repeat顯示對象時,過濾器不起作用。篩選顯示對象的ng-repeat?
如果對象的相同對象是一個對象數組,則一切都按預期工作。
這裏有一個plunker展示http://plnkr.co/edit/hBEk34U9SLlfoI5Lhitq?p=preview
Test.controller('TestController', function($scope) {
$scope.data = {
1: {value: '1'},
2: {value: '2'},
3: {value: '3'},
4: {value: '1'},
5: {value: '2'},
6: {value: '3'},
7: {value: '1'},
8: {value: '2'},
9: {value: '3'}
};
$scope.filters = {}
});
<input type="text" ng-model="filters.value">
<div ng-repeat="(id, thing) in data | filter: filters">{{thing.value}}</div>
可能重複[如何篩選(鍵,值),在AngularJs NG重複?(http://stackoverflow.com/questions/14788652/how-to -filter-key-value-with-ng-repeat-in-angularjs) – 2014-10-30 22:30:38
你絕對正確。 – Joren 2014-10-30 22:38:45