angular ng-class if-else expression example

So you want an angular if else class something like this:


If you want to include a scope variable as a class, you can’t use ng-class. So with Bootstrap classes you could do something like this to get an error class appear if your login form comes back with incorrect password (or such) and a success class if it’s a correct login.



Login controller.


Sam is a passionate web developer from England. In his spare time he enjoys coding, playing chess, reading and investing.

10 thoughts on “angular ng-class if-else expression example

  1. Good Article on Angularjs . It is possible show alert css class without use of angularjs expression . Means define something into css class ? I read many article on ng if else , one good article here –

Leave a Reply

Your email address will not be published. Required fields are marked *