javascript - How to filter nested object not equal in Angular? -
Perhaps some simple syntax may be missing, but I can not find the same filter to work:
<I can filter
: {property: {text: 'yes'}}
,
but not
< P> Filters: {property: {text: 'yes!}}
, which works for non-nested objects.
HTML:
& lt; Ul & gt; & Lt; Li ng-repeat = "attribute | filter in: attribute: {property: {text: 'yes!}}" & Gt; {{Attr.property.text}} & lt; / Li & gt; & Lt; / Ul & gt; {text: 'no'}}, {property: {text: 'no'}
js:
$ scope.attributes = [{property: {text: 'yes'}} }},];
You can get the same effect in the same way as ng-if
: & lt; Ul & gt; & Lt; Li ng-repeat = "attribute in attribute" ng-if = "atri.property.txt! == 'yes'" & gt; {{Attr.property.text}} & lt; / Li & gt; & Lt; / Ul & gt;
Alternatively you can write a custom filter that contains logic or some way to flatten the original structure. I do not think that !
is supported in nested structures.
Comments
Post a Comment