0

I want to change the state and then trigger the reload/refresh at that particular state using ui-router i had tried location.href previously but it seems that if there is hashbang then it doesn't reload the whole page ,but i want to reload the page

this.$state.go(this.$state.params.returnUrl, {}, {reload: true});

i had tried the above code but not working for me ,where returnurl is the state where i want to take the state to.

2
  • what do you mean by "reload/refresh"? do you want to reload entire page, or you just need to force state resolving process again (resolve section/controller init/etc)? Commented Dec 23, 2014 at 11:11
  • i want to reload the entire page Commented Dec 23, 2014 at 11:14

2 Answers 2

2

$state.go doesn't reload the whole page, even with reload option set to true. To reload the page you can get result url using $state.href, and reload the page with window.location

// get state's relative url with populated params
// if you want to get absolute url, then you can add {absolute:true} param
window.location.href = $state.href('state.name', {param: 'value'});
// reload the page
window.location.reload();
Sign up to request clarification or add additional context in comments.

Comments

0

Please provide some more code to identify the issue. Have you injected $state to your controller? I've used this approach before and it has worked.

2 Comments

are you sure its reloading the entire page ,have u checked your network monitor in developer tools whether its sending the get request to the server for components again
It does refresh the entire view + controller. I've not checked network monitor specifically, but an alert showing up in the success callback of a http request means that it's sending the GET request again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.