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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How to use primeng in angular 4?

934


Angularjs dependency injection of value inside of the module.config?

868


How to enable html5 mode in angular 1.x?

909


How to implement a datagrid table with angular 2 and primeng?

881


How an object or function can get a hold of its dependencies?

839


How to get and log an error in angular 4?

860


What is a dynamic route in angularjs and how do you implement it?

852


How to create angularjs filter which outputs html?

849


Give the example of angularjs strings?

859


Which version you are using js?

937


What is the latest version of angular?

956


How can primeng be used with angular2?

912


What is the latest angular?

795