Reputation: 14912
I have a json file with keys like
[
{
"message": "Verify envelopes are properly loaded.",
"hasFigure": false,
"figureX": 0,
"figureY": 0
},
{
"message": "Verify the paddle is in the down position.",
"hasFigure": true,
"figureX": 185,
"figureY": 50
}
]
I need to put this into an ng-repeat but only show the items where hasFigure
is true
I know it's a filter, but can't seem to get the syntax...
Upvotes: 2
Views: 1407
Reputation: 136154
Your filter syntax would be
For safer side use strict checking by adding
: true
at the end of filter
<div ng-repeat="item in items | filter: {'hasFigure': true}: true"></div>
Upvotes: 3
Reputation: 3986
Have you tried something like this:
<div ng-repeat="stuff in stuffs | filter: { hasFigure: true }">
Upvotes: 0
Reputation: 104775
Why not use ng-show
/ ng-hide
<div ng-repeat="item in items" ng-show="item.hasFigure"></div>
Upvotes: 0