Reputation: 10612
I have this code in my HTML
<span ng-class="newProvider ? 'newProvider' : ''"
class="help-block">
{{ 'new-product.provider.helper' | locate }}
</span>
When newProvider is true, I need to load another text like
{{ 'new-product.provider.newProvider' | locate }}
Is there anyway I can do this check for the label content? And if not, how should I load this text in the controller?
Upvotes: 1
Views: 1599
Reputation: 1264
You could define a watcher over newProvider and modify the text in the attached function.
Use $watch
for this. Here is a plunker for you to see: http://plnkr.co/edit/BAtiGXaCDIqQdw86KJwE?p=preview
However, I would prefer using ng-show
, ng-switch
or ng-if
Upvotes: 1