Tuesday 16 February 2016

Useful built-in directives in AngularJS


AngularJS Directives.jpg
A  Directive helps us to control the rendering of the HTML inside an AngularJS application. It makes AngularJS responsive. It adds functionality to the application. AngularJS has its built in set of directives. Some commonly used directives are as follows :-
1.ng-class -It is used to dynamically set the CSS class on HTML. It is very simple you just need to bind a variable into the directive “ng-class” and change it from the controller.
2.ng-repeat -ng-repeat is used to iterate over the properties of an object. It instantiates or clones a template once for each item in a collection. Usage :-
  1. <li ng-repeat="name in names">
  2. {{ name }}
  3. </li>

No comments:

Post a Comment