Answer the question
In order to leave comments, you need to log in
How to wait for core data to load before path processing starts?
I app.js
have code like this:
vtTmModule.config(function ($routeProvider, $locationProvider, $httpProvider) {
$routeProvider
.when('/someUrl', {
controller: 'SomeController'
,templateUrl: 'someTpl.html'
,resolve: {}
})
.when('/anotherUrl', {
controller: 'AnotherController'
,templateUrl: 'anotherTpl.html'
,resolve: {}
});
}).run(function ($rootScope, $routeParams, $location, UserLoader) {
UserLoader.then(function(result) {
$rootScope.users = result;
});
// Получение прочих данных с сервера через промисы
});
run(...)
, the template and controller are loaded for the corresponding URL. run(...)
I'm trying to load common data used for most paths . The problem is that this data is sometimes loaded later than the controllers and templates in which it should be used. run(...)
?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question