Reputation: 643
Please have a look at below code
Json object
namelist = [{name: "Mayur" , checked : true }, { name: "Rayum" , checked : false }]
In HTML i want to show number of items which are checked true , for above Json object count should be 1.
{{namelist.length}} // gives me total count
//can we do something like below
{{ namelist.length | filter {checked:true} }}
which we give me only count of the filtered count.
Upvotes: 0
Views: 61
Reputation: 463
Try this: {{ (namelist | filter:{checked:true}).length }}
You can read about filters here
Upvotes: 2
Reputation: 4385
Try this:
{{ (namelist | filter: { checked: true }).length }}
Upvotes: 2