I've encountered a challenge with nested state, resolve and the browser back button. Here is my states configuration: there's one abstract state and 2 children states - one for viewing a profile and another for reserving it. The standard flow involves opening the profile page, clicking on a link to open the request page, which works smoothly. However, when I click the browser back button on the "profile-request" page, the "ProfileViewController" is executed but the profileData isn't resolved. Is there a way to either reload the previous view without rendering it again or to force the promise resolution before executing the controller?
$stateProvider
.state('public', {
abstract: true,
templateUrl: 'app/public.html'
})
.state('public.profile-view', {
url: '/profile/:slug',
templateUrl: 'app/profile/profile.view.html',
controller: 'ProfileViewController',
controllerAs : 'vm',
resolve: {
profileData: function($stateParams, Profiles) {
return Profiles.query({ slug: $stateParams.slug });
}
}
})
.state('public.profile-request', {
url: '/profile/request/:slug',
templateUrl: 'app/profile/profile.request.html',
controllerAs: 'vm',
controller: 'ProfileRequestController',
resolve: {
profileData: function($stateParams, Profiles) {
return Profiles.query({ slug: $stateParams.slug });
}
}
})