Skip to content

Instantly share code, notes, and snippets.

@tastywheat
Created November 20, 2013 17:18
Show Gist options
  • Save tastywheat/7567121 to your computer and use it in GitHub Desktop.
Save tastywheat/7567121 to your computer and use it in GitHub Desktop.
ui router reloadOnSearch workaround
.run(function($rootScope){
// register listener to watch route changes
$rootScope.$on( "$stateChangeStart", function(event, toState, toParams, fromState, fromParams) {
if ( fromState.name === "watch" && fromState.name === toState.name) {
//do nothing, prevent page reload
event.preventDefault();
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment