I have an abstract base template that loads the navigation based on the user type. This part works on initial loading. The problem is I can't get the parent templateProvider to reload when the user has logged in or out afterwards. I have tried the solutions here to reload the parent template, but the nav templates aren't affected. Is there a way to reload the templateProvider, or a better way of doing this? Ideally I won't have to add the nav provider to every child route.
The routes:
$stateProvider
.state('base', {
abstract: true,
views: {
content: {
template: '<ui-view></ui-view>',
},
nav: {
templateProvider: function ($templateFactory, User, $stateParams){
if(User.exists()){
var url = '/static/html/navs/' + User.get.type + '.html';
return $templateFactory.fromUrl(url);
}
else{
return false;
}
}
}
}
})
.state('base.index', {
url: '/',
controller: 'loginController',
templateUrl: 'static/html/landing/login.html'
})
Controller function with attempts from github issue:
scope.login_submit = function(e){
e.preventDefault();
User.login(scope.login, function(res){
$state.transitionTo(
'base.dashboard', null,
{reload: true, inherit: true, notify: true }
);
});
};