AngularJS:Filter ng选项没有特定值
我想在选择上进行筛选,如下所示:AngularJS:Filter ng选项没有特定值,angularjs,angularjs-filter,Angularjs,Angularjs Filter,我想在选择上进行筛选,如下所示: <select ng-model="test" ng-options="c as c.label group by c.type for c in columns | filter:{c.type:'!field'} | filter:{c.type:'!map'}"></select> 列用于多种用途,为了优化我的代码,我需要它也位于Select中,但不包含类型为“field”或“map”的条目 然而,我可以从任何东西中选择,哪怕是“
<select ng-model="test" ng-options="c as c.label group by c.type for c in columns
| filter:{c.type:'!field'} | filter:{c.type:'!map'}"></select>
列用于多种用途,为了优化我的代码,我需要它也位于Select中,但不包含类型为“field”或“map”的条目
然而,我可以从任何东西中选择,哪怕是“字段”和“地图”类型的条目。
有干净的方法吗?AngularJS不过滤
从:
“…谓词可以通过在字符串前面加上!”来求反”
“模式对象可用于筛选数组中包含的对象的特定属性。例如{name:“M”,phone:“1”}谓词将返回一个项目数组,其中属性名称包含“M”,属性电话包含“1”…”请发布您的模型
列
感谢这一帮助。特别是关于按原样使用过滤器变量“type”的部分。而不是c型。
Columns = [
{
name: "name",
label: "Label",
info: "Information displayed in help",
type: "type",
view: "html template",
style: "min-width: 10em;",
show: true
},
{
...
}
];
<select ng-model="test" ng-options="c as c.label group by c.type for c in columns
| filter:{ type : '!field' }
| filter:{ type : '!map' }">
</select>