Angularjs Examples

AJS Examples


AngularJS Built In Directives

A directive in AngularJS is a meaningful name for a function that is attached with DOM elements. All AngularJS built in directives prefixed with the ng namespace. It is used to extend HTML elemets attribute. AngularJS directives have the ability to execute methods, define behavior, attach controllers and $scope objects, manipulate the DOM, and more.

Built in Directives

Here is a list of AngularJS built in directives with description.

DirectivesDescription
ng-app It is added to set the AngularJS section.
ng-init It sets default variable value.
ng-bind It is an alternative to {{ }} template.
ng-bind-template It binds multiple expressions to the view.
ng-non-bindable It used to not to bind data.
ng-bind-html It used to bind inner HTML property of an HTML element.
ng-change It evaluates specified expression when the user changes the input.
ng-checked It is used to set checkbox checked.
ng-class It is used to the css class dynamically.
ng-cloak It is usedv to prevent displaying the content until AngularJS has taken control.
ng-click It is used to execute a method or expression when element is clicked.
ng-controller It is used to attach a controller class to the view.
ng-disabled It is used to attach disabled attributes to the form element.
ng-form It is used to set form within a form.
ng-href It is used to dynamically bind AngularJS variables to the href attribute.
ng-include It is used to fetch, compile and include an external HTML fragment to your page.
ng-if It is used to remove or recreate an element in the DOM depending on an expression
ng-switch It is used to conditionally switch control based on matching expression.
ng-model It is used to bind an input,select, textarea etc elements with model property.
ng-readonly It is used to set readonly attribute to an element.
ng-repeat It is used to loop through each item in collection to create a new template.
ng-selected It is used to set selected option in <select> element.
ng-show/ng-hide It workes based on expression, if true then the element is shown or hidden respectively.
ng-src It is used to dynamically bind AngularJS variables to the src attribute.
ng-submit It is used to bind angular expressions to onsubmit events.
ng-value It is used to bind angular expressions to the value of <option>.
ng-required It is used to bind angular expressions to onsubmit events.
ng-style It is used to set CSS style on an HTML element conditionally.
ng-pattern It is used to add the pattern validator to ngModel.
ng-maxlength It is used to adds the maxlength validator to ngModel.
ng-minlength It is used to adds the minlength validator to ngModel.
ng-classeven It works in conjunction with ngRepeat and take effect only on odd (even) rows.
ng-classodd It works in conjunction with ngRepeat and take effect only on odd (even) rows.
ng-cut It is used to specify custom behavior on cut event.
ng-copy It is used to specify custom behavior on copy event.
ng-paste It is used to specify custom behavior on paste event.
ng-options It is used to dynamically generate a list of <option> elements for the <select> element.
ng-list It is used to convert string into list based on specified delimiter.
ng-open It is used to set the open attribute on the element, if the expression inside ngOpen is truthy.