B
B
bio2016-07-07 11:26:11
Angular
bio, 2016-07-07 11:26:11

What is the best way to load data that is used on different pages?

Good afternoon!
There is the same data which is used on several pages /users and /clients.
There are two services userService.js and clientsService.js that can load this data.
The server, on the /users and /clients pages, always returns this data.
For example, on the /users page, in the code it turns out like this:

userService.load().then(data => clientsService.setClients(data.clients));

Is it worth it to remove the issuance of an array of clients from the /users page and receive them separately using the service?
In code it looks like this:
$q.all([
    usersSerivce.load(),
    clientsService.load()
]);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-07-07
Protko @Fesor

wrap in the third service.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question