diff --git a/app/controllers/errorPageController.js b/app/controllers/errorPageController.js index f455cd6..908a49d 100644 --- a/app/controllers/errorPageController.js +++ b/app/controllers/errorPageController.js @@ -1,5 +1,25 @@ core.controller("ErrorPageController", function ($scope, AccessControlService) { - $scope.lastRoute = AccessControlService.getLastRoutePath(); + $scope.getPath = function (path) { + + if (!!path && path.length > 0) { + var paths = path.split('/'); + + for (var i in paths) { + // Return to top-level when previous path contains route variables. + if (paths[i][0] === ':') { + paths = []; + break; + } + } + + return paths.join('/'); + } + + return path; + }; + + // This is actually a URL path and not a route. + $scope.lastRoute = $scope.getPath(AccessControlService.getLastRoutePath()); });