A
A
Abc Edc2015-06-18 16:51:59
Angular
Abc Edc, 2015-06-18 16:51:59

Is it worth making independent controllers in angular directives?

Let's say a directive controller that calls a service that makes requests to get something. And in general, in general, controllers that do not overlap with the main one from the module.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-06-18
@gleber1

Let's say the controller has directives that make requests to get an array

And what about the controller? Usually services are engaged in it. In general, the controller of the directive should only deal with what is needed within the framework of this directive (that is, it contains the logic of this directive, let's say the link is needed to bind the logic and the DOM). If you need to take data there, then take it.
As much as needs. It is important that the directives are isolated pieces of functionality that have no idea about the implementation of the outside world.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question