show ng-repeat选项值除了filter中的值

时间:2018-04-18 09:43:28

标签: html angularjs

我有select ng-repeat option,如何显示optionsoptions之外的所有'TM'

<select ng-model="mainCtrl.header.selectedItemId" class="form-control">
    <option ng-repeat="option in mainCtrl.items | filter:'TM'" ng-value="option.id">{{option.name}}</option>
</select>   

1 个答案:

答案 0 :(得分:2)

如SO答案here中所述,您可以在filter

中使用否定
<select ng-model="mainCtrl.header.selectedItemId" class="form-control">
        <option ng-repeat="option in mainCtrl.items | filter:'!TM'" ng-value="option.id">{{option.name}}</option>
    </select>