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.
Official answer available
Preview the opening of the answer, then unlock the full walkthrough.
For instance, one of the fundamental directives in AngularJS is ng-model. This directive binds the value of HTML controls (like input, select, textarea) to application data. It exemplifies the two-way data binding feature of AngularJS, ensuring that any changes in the user interface instantly reflect in the application data, and vice versa.
Another commonly used directive is ng-bind. It substitutes the use of curly braces {{ }} for data binding. While both ng-bind and the double curly brace notation update the view with the value of an expression, ng-bind is favored in certain scenarios to...
easy
easy
easy
medium
medium
medium