我需要將我的視圖中的$ filter過濾器移到angularjs中的控制器中。
現在,我有這樣的事情(簡化爲只希望顯示相關的東西):
//view
ng-repeat="thing in things | filter: 'something'" where the "something" is a property of "thing".
//controller
$scope.things = $filter('filter', {whatGoesHere?:something});
我將如何訪問相同的嵌套屬性從控制器?我對每個「東西」鍵都使用firebase是唯一的標識符。
謝謝。
編輯:我的目標是這樣的:
things: {
thingID1: {
something: 'value';
},
thingID2: {
something: 'value'
},
...
}
在做了一些更多的研究之後,它看起來像我需要使用這樣的東西:https://gist.github.com/katowulf/bee266e31aa60cb0eed6但我無法fi確切地說明如何使用這個。 – EmptyPockets