I am wondering how to "reload" a current state, passing in a new parameter so that my controller gets re-initialized.
I am trying to implement a search in my sidebar control - and the initial search uses $state.go to transition to my new state like this:
if ($event.type === 'click' || $event.keyCode === keyCodes.enter) {
$state.go("people.search", { search: vm.searchText });
If I am on another state in the application, and the above code runs, everything works correctly. So, I pass in the search term as a parameter and $state.go transitions my state to the people.search state and my people controller (containing the search function) gets hit. But once I am on the people.search state and try to use the search control, the people controller code does not get hit anymore and the parameters are not getting updated.
I tried modifying the code to this:
$state.go("people.search", { search: vm.searchText }, { location: "replace" });
Now when I am on the current state, this will update the url with my new search term, but the controller code is not firing.
I need a way to force a reload of the same state that I am currently on, so that the new search parameter gets updated and the people controller code re-runs.
How do I reload the current state?