2

I want to hide a div depending on the value I have in the json

for example I have this {{product.currency}} and the value can be: £ or € if the value is equal € I want to hide this element.

1 Answers1

5

fairly simple with ng-hide or the opposite ng-show or to not have it in page use ng-if

<div ng-hide="product.currency =='€'" >
 <!-- or -->
<div ng-show="product.currency !='€'" >
 <!-- or -->
<div ng-if="product.currency !='€'" > 

And one more alternative, not as elegant or efficient is ng-switch.

It is well worth spending a bit of time looking through all the core directives shown in menu on left side of API reference docs.

charlietfl
  • 170,828
  • 13
  • 121
  • 150