How can we restrict Directives to be invoked only by specific methods?

 Posted by Chvrsri on 3/28/2016 | Category: AngularJS Interview questions | Views: 994 | Points: 40
Answer:

We can restrict the Directive by using a Property "restrict" with value "A" so it will be invoked only by attributes.

var app = angular.module("myApp", []);

app.directive("DNFTestDirective", function() {
return {
restrict : "A",
template : "<h1>DotnetFunda is the best for Online Dotnet Support</h1>"
};
});


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response