Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
A button that changes appearance for the duration of some long action. The dropdown menu for the element.
A text field that adjusts the height to fit the content. Input field with add. design and behavior (as in Material Design, for example)
A directive is, roughly speaking, a function (a piece of code/logic) "tied" to an element.
1) If you need to do something with the element
2) or if you have logic in the controller for working on the element (ngStyle/ngClass,ngClick...) and you need to reuse this logic in different places, then you can make a directive and use it so as not to copy-paste the code.
Here is an example of a simple Angular Light directive: jsfiddle.net/lega911/vrfdqbu8
Try to make an analogue with ngStyle, you will have to fiddle with variables for each case (although you can isolate controllers), in general, more code and copy-paste.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question