Answer the question
In order to leave comments, you need to log in
AngularJS preload, how to file it?
Hello, this is the situation, data comes from the server, is transferred to $rootScope in the callback, but due to the fact that this process is asynchronous, all the data that should be loaded on this page from $rootScope does not have time to be initialized, how to postpone this process and do something like a page preload so that the data has time to arrive, calmly rely on $rootScope and then initialize, I will be grateful if you point me in the right direction :)
Answer the question
In order to leave comments, you need to log in
odetocode.com/blogs/scott/archive/2014/05/20/using... Routing
has a resolve parameter Route
won't load until (including template) resolve is executed
resolve: {
preload: function ($http, $rootScope) {
retun $http.post().then(function (result) {
$rootScope.someData = result.data
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question