Here is plnkr: http://plnkr.co/edit/wfIFA01kfG1zggsPo7Q9
I have one abstract parent state 'app' and two child states 'app.home' and 'app.signin'. Parent state has to resolve some asynchronous stuff.
app.core:
$stateProvider
.state('app', {
url: '',
abstract: true,
// has to be resolved by any child state, except app.auth
resolve: {
Something: function($http) {
// real delay
return $http.get('http://httpbin.org/delay/5');
}
}
});
app.home:
$stateProvider
.state('app.home', {
url: '/home',
views: {
'main@' : {
template: '<div>I am home page</div> <a ui-sref="app.signin">Sign in</a>'
}
}
});
app.signin
$stateProvider
.state('app.signin', {
url: '/',
views: {
'main@' : {
template: '<div>I am signin page </div> <a ui-sref="app.home">Home page</a>'
}
}
});
I want any child state require Something too, except app.signin. How can I do that?
Also worth to mention, I do not describe any resolvers at my child states. But they still wait till the parent is done, and I thought that (quote from ui-router doc):
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.
And I dont know why child states still resolving parent`s dependency.
app.signinstate somehow in order to be able ignore parent`s resolver.