Wednesday, April 2, 2014

AngularJS Add Class and Toggle Class

There are several ways of adding a class to an element in angularJS which varies in different situations. I want to put the solutions without much of explanation in angularJS terminology, because sometimes it scares to the HTML developers, so I won't get into that. I will just post some plane code which will be useful to most of the developers and designers.

Add/Remove Class:
The directive you need to read to understand this example:
ng-app  ng-click and ng-class




Toggle Class Example 1:
The directive you need to read to understand this example:
ng-controller ng-app  ng-click and ng-class




Toggle Class Example 2:
The directive you need to read to understand this example:
ng-init ng-app  ng-click and ng-class



Related Articles:
- AngularJS Toggle Class with Animation



No comments:

Post a Comment