Skip to content

Instantly share code, notes, and snippets.

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