-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Milestone
Description
Version 0.2.13
In my parent state I have a resolve. Currently, I do not inject the resolve key in any child state.
I assumed that my child state would not wait for this resolve/promise to be resolved. But when I set a timeout, I can see my child state does wait.
It states in the documentation "The resolve keys MUST be injected into the child states if you want to wait for the promises to be resolved before instantiating the children." I have not injected in the userDetails yet to the billingController but it still waits
Code snippet:
.config(function ($stateProvider, $urlRouterProvider, STATES) {
$stateProvider
.state(STATES.ROOT, {
abstract: true,
template:'<div ui-view=""></div>',
resolve: {
UserService: 'UserService',
userDetails: function(UserService){
return UserService.getUserProfile();
}
}
})
.state(STATES.BILLING, {
url: '/bill/checkClientContext.html',
templateUrl: 'bill/checkClientContext.html',
controller: 'BillingController'
})
UserService.js
'use strict';
angular.module('nabc.data')
.service('UserService', ['AjaxService', '$timeout','$q', function(AjaxService, $timeout, $q) {
var getUserProfile = function() {
var promise = AjaxService.get('userProfile');
var deferred = $q.defer();
$timeout(function(response){
deferred.resolve(response);
}, 5000);
return deferred.promise;
};
return {
getUserProfile: getUserProfile
};
}]);
Am I missing something?
Thanks,
Shane.
Metadata
Metadata
Assignees
Labels
No labels