B
B
Bogopodoben2016-08-10 20:10:34
Angular
Bogopodoben, 2016-08-10 20:10:34

How to correctly initialize data from the server before rendering the page?

The essence of the problem is this, there is some user data on which the rendering of the page depends. Accordingly, this data needs to be loaded at the time of loading the angular modules.
How it is better to implement it? The data is thrown into $rootScrope, but it would be better if they were thrown into the service.
I tried to inject the service into bootstrap, but it didn't work. Most likely he just didn't do it right. Share methods, such implementation of a problem.
I tried it in resolve ui routera, but I ran into a problem that I couldn’t load pages with this resolve, without errors, without anything. It just doesn't open.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lega, 2016-08-10
@lega

You can inject the primary data into the beginning of the html, then they will be there even before the angular itself is loaded.
+ save on calls and delays

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question