S
S
SheldonCoop2016-04-22 17:31:41
JavaScript
SheldonCoop, 2016-04-22 17:31:41

How to properly style controller interaction in AngularJS?

For example, there are two controllers. In one of them, a request is sent to the server to receive data. It is necessary that when a certain function is executed in the second controller, a request to the server would be executed in the first one. How to implement this? Or is this generally a bad idea and the architecture needs to be redone?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-04-22
Protko @Fesor

Or is this generally a bad idea and the architecture needs to be redone?

When everything happens in your controllers, what kind of architecture can we talk about?
In short, put everything into a service, and then there will be no need for controllers to interact with each other.

O
Oleg Lustenko, 2016-04-22
@fakey0u

why requests to the server in controllers?
Submit a request to the service, after executing the function in controller number 2, call the service

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question