Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aweigold/9dfe07a63979c0681eac517fa96ef917 to your computer and use it in GitHub Desktop.
Save aweigold/9dfe07a63979c0681eac517fa96ef917 to your computer and use it in GitHub Desktop.
Listens to ui-router for state changes and changes the window location if the current page is an error page.
$rootScope.$on('$stateChangeStart', function(evt, to, params){
var isError = $windowProvider.$get().document.querySelector("meta[name='yourErrorPageTag']");
if (isError) {
evt.preventDefault();
$windowProvider.$get().location = "/apppath/index.html" + $windowProvider.$get().location.hash;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment