0

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 }); } 

1 Answer 1

0

Naturally right after I posted this question I found the exact answer I was looking for.

This stackoverflow helped me alot. I ended up using the following

$state.go('index.main.user', { userID: user._id }, {reload: 'index.main.user'); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.