I have multiple nested views in Ui router. I want to know if it's possible for them all to share one controller for the some identical functionality, and then have their own controllers for other functionality. I'd like this parent controller to make a few api calls, and store some scope variables so I don't have to make these calls individually inside each controller. I know I can achieve something similar with a resolve, but is 2 controllers for one view possible?
heres an example of my code of what my code looks like
.state('app.user', {
url: '/user',
resolve: {
userData: ["UserService", function(UserService) {
return UserService.getuser().then(function(profile) {
UserService.profile = profile.data;
UserService.currentId = profile.data.user.id;
return profile.data;
});
}]
},
views: {
'content@': {
templateUrl: ENVApp + '/views/user/profile.html?',
controller: 'UserController'
},
'addresses@app.user': {
templateUrl: ENVApp + '/views/partials/addresses?',
controller: 'UserAddressController'
}
}
})