angular ng-class if-else expression example

Handsontable JavaScript Spreadsheet Most popular component for web apps

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 Deering

Sam Deering

Sam is a web developer, online entrepreneur and investor. In his spare time he enjoys coding, playing chess and sharing what he learns with others.

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 *