可以使用複選框刪除過濾器嗎?如何動態禁用ng-repeat內的過濾器
如果選中複選框,則禁用ng-repeat內的過濾器。例如,如果複選框countryfilter和winetypefilter被選中,相關的過濾器將被禁用。
原代碼(啓用過濾器)
<li ng-repeat="wine in wines | winetypefilter:winetypes| countryfilter:countrytypes | stylefilter:styletypes">
{{wine.name}} is a {{wine.type}} with {{wine.style}} style from {{wine.country}}
</li>
(過濾器與複選框禁用,countryfilter和winetypefilter) 會導致:
<li ng-repeat="wine in wines | stylefilter:styletypes">
{{wine.name}} is a {{wine.type}} with {{wine.style}} style from {{wine.country}}
</li>
我認爲你將不得不編寫自己的自定義過濾器 – nilsK