Skip to content
This repository was archived by the owner on Nov 7, 2018. It is now read-only.

Commit 2f990f8

Browse files
Redirect to 404 page when server returns not found error
1 parent eb9b195 commit 2f990f8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

dashboard-project-app/client/app/projectDetail/controllers/projectDetail.controller.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
(function(){
33

44
angular.module('dashboardProjectApp')
5-
.controller('projectDetailController', ['$scope','$state', 'UserStory',
6-
function($scope, $state, UserStory) {
5+
.controller('projectDetailController', ['$scope','$state', 'UserStory', '$location',
6+
function($scope, $state, UserStory, $location) {
77

88
$scope.taskId = $state.params.id;
99
$scope.openTasks = {};
@@ -39,6 +39,7 @@
3939
$scope.actualProject = {};
4040

4141
function getFile() {
42+
4243
UserStory.findById({id:$scope.taskId},
4344
function success(userStory) {
4445
$scope.userStory = userStory;
@@ -48,14 +49,15 @@
4849
$scope.actualProject[key] = $scope.userStory.tasks_status[key].projects[0]
4950
}
5051

52+
}, function onError(error){
53+
$location.path('/projectDetail/notFound/' + $scope.taskId);
5154
});
5255
};
5356

5457
$scope.selectProject = function(keyProject, idTask){
5558
$scope.actualProject[idTask] = keyProject
5659
}
5760

58-
getFile();
5961

6062
$scope.showMore = function(key){
6163
$scope.showText[key] = true;
@@ -69,13 +71,15 @@
6971
window.location.href = "mailto:" + email + "?subject=Mail to " + email;
7072
}
7173

74+
getFile();
7275

7376
}])
7477
.filter('capitalize', function() {
7578
return function(input) {
7679
return (!!input) ? input.charAt(0).toUpperCase() + input.substr(1).toLowerCase() : '';
7780
}
78-
}).filter('removeDashes', function() {
81+
})
82+
.filter('removeDashes', function() {
7983
return function(string) {
8084

8185
if (!angular.isString(string)) {

0 commit comments

Comments
 (0)