If a user needs to reset their password I send them a URI that looks something like this.
http://this.that/login?resetKey=1234
After the user finishes the steps to reset I want to clean up the URI so if they hit the refresh button it doesn't trigger the reset process again.
http://this.that/login
I had the worse time finding an answer on google. After a few days of digging through UI Router documentation I finally found a combination that worked.
First you need to inject the $state param into your controller. We'll use the go method and redirect to the current URI using the current router name. The current route name can be accessed through the $state.current.name property. Next we need to specify the parameter we want to remove from the URI. We'll use an object with the key as the param name and the value will be null. Lastly we don't want to trigger the route again so we'll set the notify property to false.
The final command looks like this.
$state.go($state.current.name,{'resetKey': null},{'notify': false});
Such a simple command. So much digging. UGH!