goo
goo

Reputation: 2280

Angularjs: If equals array

I have an array: [1, 2, 3, 4, 5]

Using ng-show (e.g. ng-show="foo == bar"), how would you determine if a number equals one of those numbers in the array?

Upvotes: 1

Views: 598

Answers (1)

ravenlp
ravenlp

Reputation: 394

Lets say you have the array foo and the number is 118 so this should work

ng-show="foo.indexOf(118) != -1"

Upvotes: 3

Related Questions