Explain what is directive and mention what are the different types of directive?
Answer / Anshuman Verma
In AngularJS, a directive is a mechanism to extend HTML vocabulary. It allows you to create custom, reusable, and extendable HTML tags. Directives can be used for creating new HTML elements, modifying existing HTML elements, or adding behavior to HTML attributes. There are four types of directives: component (class-based), function, attribute, and comment.nComponent Directive:n```typescriptn@Component({n selector: 'app-example',n templateUrl: './example.component.html'n})nclass ExampleComponent {n}n``nAttribute Directive:n```javascriptnfunction exampleDirective() {n return {n restrict: 'A',n link: function(scope, element, attrs) {n // Custom behavior heren }n }n}n``
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between $scope and scope in angular?
Which of the following directive is used to initialize an angular app?
How to using looping through a collection for each item in angular js?
Give an example of Data binding in AngularJS?
Why do we use angularjs?
What is the difference between angularjs and angular?
Is angular a programming language?
What are animating elements in angularjs?
Write the difference between directive and component in angular js?
What is the key difference between angular expressions and javascript expressions?
What is new in Angular 8?
What is if-else-and-then conditions in angular4?