Here is my test application http://plnkr.co/edit/OjpZ1h?p=preview
I have 404 error page state, and i need to display path of requested page if this page not exists. Here code of redirection:
$urlRouterProvider.otherwise(function($injector, $location){
var lastPath = $location.path();
$injector.invoke(['$state', function($state) {
var params = angular.copy($state.params);
$state.go('main.error404',params, {location: false});
}]);
return lastPath;
});
All works fine except the situation when app already in error state and i'm going to next page that also don't exists.
In this case reload doesn't happens and it displays path of the last page. If i change this code to
$state.go('main.error404',params, {reload: true,location: false});
then is displays right path but all views are reloading, it looks very nasty with animation.
Is there way to reload specific ui-view with angular-ui-router?
pathparameter tomain.error404state. This will cause the state to be reloaded when the parameter changes