AngularJS:过滤NG选项不具有特定值 [英] AngularJS: Filter ng-options not having specific values
问题描述
我要上筛选选择像这样:
<选择NG模型=测试NG选项=C作为c.label组由c.type在C列
|过滤器:{c.type:'场'} |过滤器:{c.type:地图!'}>< /选择>
编辑:添加列模型:
列= [
{
名称:名称,
标签:标签,
信息:中显示的信息的帮助
类型:类型,
观点:HTML模板
风格:最小宽度:10em;,
显示:真
},
{
...
}
];
列,用于几件事情,并优化我的code我需要它也处于选择,但没有它的类型是'场'也不是地图中的条目
不过,我得到的一切选择,即使它的类型是田和地图中的条目。
有没有干净的方式做到这一点?
感谢
AngularJS不过滤
<选择NG模型=测试NG选项=C作为c.label组由c.type在C列
|过滤器:{类型:'场'}
|过滤器:{类型:'地图!'}>
< /选择>
在 文档
的...的predicate可以通过prefixing以字符串被否定!的
的的模式对象,可以用来对数组包含的对象过滤特定的性质,例如{名:M,电话:1} predicate将返回其中有一个项目数组含M和含有1物业电话...属性名的
I want to filter on a select like so :
<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>
EDIT : Adding the column model :
Columns = [
{
name: "name",
label: "Label",
info: "Information displayed in help",
type: "type",
view: "html template",
style: "min-width: 10em;",
show: true
},
{
...
}
];
Columns is used for several things and to optimize my code I need it to be also in a Select, but without the entries whose type are 'field' nor 'map'
Yet, I get to choose from everything, even the entries which types are 'field' and 'map'. Is there a clean way to do it ?
Thanks
AngularJS NOT Filter
<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>
From the docs:
"...The predicate can be negated by prefixing the string with !."
"A pattern object can be used to filter specific properties on objects contained by array. For example {name:"M", phone:"1"} predicate will return an array of items which have property name containing "M" and property phone containing "1"..."
这篇关于AngularJS:过滤NG选项不具有特定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!