I have the following ui-router states.
.state('admin.userView', {
abstract:true,
url:'/user/:id/',
templateUrl:'./views/user/view.html',
controller:'userViewController'
})
.state('admin.userView.home', {
url:'',
templateUrl:'./views/user/home.html',
controller:'userHomeController'
})
I have fetched user details using http resource in userViewController to $scope.users. When i move to the admin.userView.home state, I can access the $scope.users . But when i refresh page with child state, the value in the $scope.users is lost. How can i get the same.
Try moving that data into the resolve property of the
admin.userView
state declaration. Since you're using nested resolves here you can then inject that resolved data into theadmin.userView.home
state declaration. Here's an excerpt from the ui-router documentation.Source