I'm using $state.go("titulos", params) to load the titulos page, in which case the parent controller (emissao) is not loaded again. But when I call the grandchildren $state.go("titulos.fluxos", params) the parent controller (titulos) is loaded again. I do not want this to happen, because the parent controller is already loaded, this is an unwanted behavior. I do not know why the first child works perfectly without loading the parent, but for the grandchild (titulos.fluxos) unnecessarily load his parent (titulos). How could I solve this? please.
$stateProvider.state('emissao', {
url: '/emissao',
views: {
'main': {
controller: 'emissaoCtrl',
templateUrl: 'view/emissao.html'
}
},
resolve: {
emissoes: function (cadastroAPI) {
return cadastroAPI.listar('emissao');
}
}
});
$stateProvider.state('titulos', {
parent: 'emissao',
url: '/titulos',
controller: 'titulosCtrl',
templateUrl: 'view/titulo.html',
resolve: {
titulos: function (cadastroAPI, $stateParams) {
return cadastroAPI.listarTitulos($stateParams.parent.obj);
}
},
params: {
parent: null,
container: null
}
});
$stateProvider.state('titulos.fluxos', {
url: '/fluxos',
controller: 'fluxosCtrl',
templateUrl: 'view/fluxo.html',
resolve: {
fluxos: function (fluxoAPI, $stateParams) {
return fluxoAPI.listar($stateParams.parent.obj.Id);
}
},
params: {
parent: null,
container: null
}
});