Answer the question
In order to leave comments, you need to log in
What is a directive and why are they needed in angular.js?
I found a bunch of articles on the Internet that tell how to use directives, examples, etc. But they never wrote what it is, why it is needed and what alternatives there are.
On Habré, articles basically describe directives like this:
AngularJS directives are cool
directives are the main highlight of the declarative ...
Directives are a key feature of AngularJS.
etc...
Answer the question
In order to leave comments, you need to log in
The directive is an extension of html markup.
You can create a tag directive, for example <ui-select></ui-select>
, and describe what it does.
You can create an attribute for a tag, for example, <button ng-click="doSmth()"/>
and describe how it affects the behavior of the tag.
Etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question