E
E
Evgeny Fedorov2015-12-08 18:49:39
Angular
Evgeny Fedorov, 2015-12-08 18:49:39

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

2 answer(s)
M
moondog, 2015-12-08
@moondog

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.

S
Sergey, 2015-12-08
@Sergamers

Watch the video , it might help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question