2. What are Directives?
Directive is a unique and powerful feature available in angular.
❖Markers on a DOM element
❖AngularJS comes with a set of predefined directives
❖Developers can create a custom directives
3. Why Directives?
❖Tells the compiler to attach a specified behaviour to the DOM element
● Adds Behaviours
● Data Binding to scope
● Replace (or) extend the HTML element
4. How To Use Directives:
Basic Directives:
ng-app
ng-model
ng-bind
ng-controller
ng-init
5. DOM Directives
ng-click : performs operation on element click
ng-disabled : disables the element by condition
ng-show : shows element based on condition
ng-hide : hides element based on condition
Example:
https://jsfiddle.net/mwL8c2e4/1/