I made several error conditions, for example:
.state('notFound', { url: '/errors/404', template: '<h1>Not Found</h1>' }) .state('accessDenied', { url: '/errors/403', template: '<h1>Access Denied</h1>' })
Then, when you handle the error, add a parameter to not update the location:
$state.go('notFound', {}, {location: false});
This leads to a change in the status of notFound, but it does not update the address bar of the browser, so the user still sees the previous URL at your request.
source share