I have spent quite a lot of time reading through AngularJS documentation and several tutorials, and I have been quite surprised at how unapproachable the documentation is.
I have a simple, answerable question that may also be useful to others looking to pick up AngularJS:
What is an AngularJS directive?
There should be a simple, precise definition of a directive somewhere, but the AngularJS website offers these surprisingly useless definitions:
Directives are a unique and powerful feature available in AngularJS. Directives let you invent new HTML syntax, specific to your application.
In the developer documentation:
Directives are a way to teach HTML new tricks. During DOM compilation directives are matched against the HTML and executed. This allows directives to register behavior, or transform the DOM.
And there is a series of talks about directives which, ironically, seem to assume the audience already understands what they are.
Would anyone be able to offer, for clear reference, a precise definition of what a directive is that explains:
- What it is (see the clear definition of jQuery as an example)
- What practical problems and situations it is intended to address
- What design pattern it embodies, or alternatively, how it fits into the purported MVC/MVW mission of AngularJS.