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 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.