Angular is one of the most current web development frameworks around the world. In almost every interview, you will have to struggle with fierce competition, in order to achieve high…
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.
- Template: It describes an inline template as a string.
- 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.
- Replace: It replaces the current element if the condition is true, if false append this directive to the current element.
- Transclude: It allows you to move the original children of a directive to a location inside the new template.
- Scope: It creates a new scope for this directive rather than inheriting the parent scope.
- Controller: It creates a controller which publishes an API for communicating across the directives.
- Require: It requires another directive to be present to function the current directive efficiently.
- Link: It modifies the resulting DOM element instances, adds event listeners, and set up data binding.
- 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.