Is there a way to display a standard error page or template if a certain template cannot be loaded using ngRoute
in Angular?
I've come across suggestions that subscribing to the $routeChangeError
event might help, but I'm not sure what steps to take next.
$rootScope.$on("$routeChangeError", function (event, current, previous, rejection){
// How can I instruct the routing engine to load my error page (such as 404 or 500)?
});
Can this be implemented globally, or does it need to be set up on a per-controller basis? My website is currently transitioning from jQuery to Angular, with different parts still utilizing different approaches.