I have a dictionary like this:
var data = {
a: [1, 2, 3, 4, 5],
b: [
[1, 2],
[3, 4],
[5, 6]
]
};
Now I need to use ng-hide
to hide an element if 2
exists in data->a
. It would be done easily like this:
<i ng-hide="(data.a | filter:2).length">2 not found</i>
Now how I can do it with data->b
? I need to hide the message if 2
is found in any of data->b
items.
I found How do I only show an element if nested ng-repeat is not empty?. But I need to show to message only once.
ng-hide="(data.b | filter:2).length"
works for me – New Dev Jan 16 at 2:04I need to show to message only once.
[if not empty] ? confusing.. :/ – PSL Jan 16 at 2:06b
's elements doesn't contain2
, the2 not found
message will be shown twice. I need to hide the message, only once, if2
appears in any ofb
's lists. – AliBZ Jan 16 at 2:49