Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Um, documentation ?
Don't make a synchronous request.
Change everything so that everything stays asynchronous.
If it is not possible without routes, either inject data directly into the page or do it before the angular AngularJS bootstrap, loading the config before launching the application
all requests to the $http service are asynchronous, moreover, it is highly discouraged to even think about synchronous requests (because this will freeze the entire application, will not process $digest cycles, etc.).
Well, yes, documentation. It's all well written there. I also advise you to read about promises.
The point is that a synchronous request needs to be executed, because it loads the routes, and without them the client part will not be able to work at all.
Try adding the following js code to the very end of the <body> , provided that you have routes in the $routes variable.
Then the routes constant can be injected anywhere. At least at the configuration stage, at least in the controller, even in the directive.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question