Reputation: 8424
I am trying to apply class conditionally through ng-class but its not working
ng-class="{'margin-watch':progress <= '0','margin-continue-watch':progress > '0' }"
Upvotes: 0
Views: 82
Reputation: 1385
Unless your condition requires you to compare progress to the character '0', you should remove the quotes around the 0. That should fix your expressions! For readability I suggest you apply the () as Yasser does in his answer, but it should work without aswell.
Upvotes: 1
Reputation: 47774
Try this
ng-class="{'margin-watch': (progress <= 0), 'margin-continue-watch': (progress > 0) }
Upvotes: 1