V
V
vasIvas2015-07-19 21:59:17
Angular
vasIvas, 2015-07-19 21:59:17

What is a directive in mv* concept in AngularJS?

Here's how I think. Angular is, as stated, mv*. So if I use controller, model and ng-bind, then I use mvc. If I use ng-model which provides two-way binding (which is rightly called data binding, at least in flex and it's not clear why the authors of angular distorted it in the opposite direction), then I automatically implement mvvm.
And so it turns out that in the first case I severely violate the mvc concept by deciding for the model in the directive what to do. And in the second case, it is not clear from which side the controller came from, and why vm is still higher than the model.
It's like a hungry mouth will make a decision for the brain to gobble up a whole watermelon.
So what is a directive?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
�
âš¡ Kotobotov âš¡, 2015-07-19
@vasIvas

directive - a piece of an embedded independently operating component (application).
which you can embed in HTML like a normal tag (in the concept of web components).
that is, if we speak within the framework of MVC, then this is another mvc.
and just don't worry about the concept, they are developed to make life easier, in some applications it is convenient to combine the controller with the appearance, sometimes it is convenient to combine the controller and the model. The main thing is not to try to fit everything into some dogma.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question