What are directives in AngularJS?
Instruction: Define what directives are in AngularJS and give examples of common directives.
Context: This question tests the candidate's knowledge of AngularJS directives, their purpose within the framework, and their ability to provide examples of how and when they are used.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
A directive tells AngularJS how to attach behavior to matched template markup during compilation and linking. Depending on its definition, it can match an element, attribute, class or comment. A custom element-shaped directive is not automatically a browser Web Component.
Common examples include ngBind for text output, ngModel for supported form-control binding, ngClick for an event expression, ngIf for conditional creation/removal, and ngRepeat for repeated templates...
Related Questions
-
easy
-
easy
-
easy
-
medium
-
medium
-
medium