I have a state and a nested state in my app.js file. The parent state has a button that controls what is viewed in the nested state, this is done by setting url parameter and the nested state's controller figures out what to show. I want to reload JUST the nested state when the user clicks the button.
I have both the parent state and the state I want to be reloading now on click.
I found this stackoverflow but the button being click is on the same page as the view being reloaded.
App.js file
.state('index.main', {
url: 'main/:userID',
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.state('index.main.user', {
url: '/',
views: {
'user@index' : {
templateUrl: 'views/user.html',
controller: 'UserCtrl'
}
}
})
Parent Controller
$scope.showUser = function(user) {
$state.go('index.main.user', { userID: user._id });
}