Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Explain what is directive and mention what are the different types of directive?



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

Post New Answer

More AngularJS Interview Questions

What is the difference between $scope and scope in angular?

1 Answers  


Which of the following directive is used to initialize an angular app?

1 Answers  


How to using looping through a collection for each item in angular js?

1 Answers  


Give an example of Data binding in AngularJS?

1 Answers  


Why do we use angularjs?

1 Answers  


What is the difference between angularjs and angular?

1 Answers  


Is angular a programming language?

1 Answers  


What are animating elements in angularjs?

1 Answers  


Write the difference between directive and component in angular js?

1 Answers  


What is the key difference between angular expressions and javascript expressions?

1 Answers  


What is new in Angular 8?

1 Answers  


What is if-else-and-then conditions in angular4?

1 Answers  


Categories