简体   繁体   中英

AngularJS filter array

Let say I have an array object

[{
    name: 'a',
    number: 1
},
{
    name: 'b',
    number: 2
},
{
    name: 'c',
    number: 3
}]

And I just want to get the name:'b' which is array[1] values. How to pass it to the filter?

<li ng-repeat="foo in foos | filter:what_to_do_here="b"><li>
<li ng-repeat="foo in foos | filter:{name:'b'}">{{foo.name}}</li>
<li ng-repeat="foo in foos | filter:'b'">{{foo.name}}</li>

可能也会起作用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM