我不知道如何編寫這個過濾器表達式。AngularJS ng-repeat和切換過濾器開啓/關閉?
我的文檔的數組:
[{title: 'doc1', read: false}
{title: 'doc2', read: false}
{title: 'doc3', read: false}
{title: 'doc4', read: true}
{title: 'doc5', read: false}]
在視圖我有
<input type="checkbox" ng-model="filterRead">
<div ng-repeat="doc in documents track by $index | filter: ??? ">
{{doc.title}}
</div>
如果該複選框/ filterRead是真實的,不分配過濾器並顯示所有文件。如果複選框爲false,則只顯示doc.read = false的文檔。我不知道如何優雅地編寫這個過濾器表達式。
可能重複的[製作的角過濾條件](http://stackoverflow.com/questions/29738014/making-an-angular-filter-conditional) –