微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

AngularJS:过滤ng选项没有特定的值

我想过滤一个选择,像这样:
<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>

编辑:添加列模型:

Columns = [
{
    name: "name",label: "Label",info: "information displayed in help",type: "type",view: "html template",style: "min-width: 10em;",show: true
},{
 ...
}
];

列用于几个事情,并优化我的代码我需要它也在一个选择,但没有类型为’field’或’map’的条目,

然而,我可以从一切中选择,即使是类型是“字段”和“地图”的条目。
有干净的方法吗?

AngularJS NOT过滤器
<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>

Fiddle

docs

“…可以通过使用!前缀字符来否定谓词。

例如{name:“M”,phone:“1”}谓词将返回一个具有属性名称包含“M”和属性电话的项目数组包含“1”…“

原文地址:https://www.jb51.cc/angularjs/145740.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐