angular ng-class if-else expression example

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

or

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.

Image

Image

Login controller.

HTML

Sam is a passionate web developer, online entrepreneur and investor. In his spare time he enjoys coding, playing chess and reading.

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 – http://goo.gl/bZGU6t

Leave a Reply

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