Rom*_*ain 31 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>
Run Code Online (Sandbox Code Playgroud)
编辑:添加列模型:
Columns = [
{
name: "name",
label: "Label",
info: "Information displayed in help",
type: "type",
view: "html template",
style: "min-width: 10em;",
show: true
},
{
...
}
];
Run Code Online (Sandbox Code Playgroud)
列用于几个方面并优化我的代码我需要它也在Select中,但没有类型为'field'或'map'的条目
然而,我可以选择所有内容,甚至是"字段"和"地图"类型的条目.有干净的方法吗?
Alw*_*ner 71
<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>
Run Code Online (Sandbox Code Playgroud)
来自文档:
"...可以通过在字符串前加上!来取消谓词."
"模式对象可用于过滤数组包含的对象的特定属性.例如{name:"M",phone:"1"}谓词将返回一个项目数组,其属性名称包含"M"和属性电话包含"1"......"
归档时间: |
|
查看次数: |
67180 次 |
最近记录: |