What are the most used directives in AngularJS?

Discussion RoomCategory: General QuestionWhat are the most used directives in AngularJS?
Nick asked 5 years ago

A directive is something that introduces new syntax; they are like markers on DOM element which attaches a special behavior to it. In any Angular.js application, directives are the most important components.
Some of the commonly used directives are ng-model, ng-App, ng-bind, ng-repeat , ng-show etc.
ng-app:Auto bootstrap AngularJS application.

  • ng-initInitializes:AngularJS variables
  • ng-model:Binds HTML control’s value to a property on the $scope object.
  • ng-controller:Attaches the controller of MVC to the view.
  • ng-bind:Replaces the value of HTML control with the value of specified AngularJS expression.
  • ng-repeat:Repeats HTML template once per each item in the specified collection.
  • ng-show:Display HTML element based on the value of the specified expression.
  • ng-readonly:Makes HTML element read-only based on the value of the specified expression.
  • ng-disabled:Sets the disable attribute on the HTML element if specified expression evaluates to true.
  • ng-if:Removes or recreates HTML element based on an expression.
  • ng-click:Specifies custom behavior when an element is clicked.
Scroll to Top