What are the attributes that can be used during the creation of a new AngularJs directives?

There are several attributes which can be used during a new directive creation.

They include:

  1. Template: It describes an inline template as a string.
  2. Template URL: This attribute specifies the AngularJs HTML compiler to replace the custom directive inside a template with the HTML content located inside a separate file.
  3. Replace: It replaces the current element if the condition is true, if false append this directive to the current element.
  4. Transclude: It allows you to move the original children of a directive to a location inside the new template.
  5. Scope: It creates a new scope for this directive rather than inheriting the parent scope.
  6. Controller: It creates a controller which publishes an API for communicating across the directives.
  7. Require: It requires another directive to be present to function the current directive efficiently.
  8. Link: It modifies the resulting DOM element instances, adds event listeners, and set up data binding.
  9. Compile: It modifies the DOM template for features across copies of a directive, as when used in other directives. Your compile function can also return link functions to modify the resulting element instances.

Top 50+ Angular Interview Questions with Answers

Angular is one of the most current web development frameworks around the world.  In almost every interview, you will have… Read More

4 years ago