How to show a vlaue in angularjs ng-show like
ng-show = "role in ['admin', 'user', 'buyer']"
need to show a div if role is any of the things in that array.
Use the function indexOf
in array to find whether a element is part of the array. It will return the position of the element if found or will return -1.
So you can use an expression like
ng-show = "['admin', 'user', 'buyer'].indexOf(role)!=-1"
to show/hide data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With