angular supress unhandled rejection

This commit is contained in:
Mo Bitar
2016-12-18 00:09:57 -06:00
parent d527c8d34b
commit 3794d0496c
8 changed files with 95 additions and 86 deletions

View File

@@ -3,18 +3,16 @@
var Neeto = Neeto || {};
if(window.crypto.subtle) {
console.log("using WebCrypto");
// console.log("using WebCrypto");
Neeto.crypto = new SNCryptoWeb();
} else {
console.log("using CryptoJS");
// console.log("using CryptoJS");
Neeto.crypto = new SNCryptoJS();
}
angular.module('app.frontend', [
'ui.router',
'ng-token-auth',
'restangular',
'ipCookie',
'oc.lazyLoad',
'angularLazyImg',
'ngDialog'
@@ -40,3 +38,6 @@ angular.module('app.frontend', [
};
});
})
.config(['$qProvider', function ($qProvider) {
$qProvider.errorOnUnhandledRejections(false);
}]);

View File

@@ -17,7 +17,7 @@ angular.module('app.frontend')
}
}
})
.controller('HeaderCtrl', function ($auth, $state, apiController, modelManager, serverSideValidation, $timeout) {
.controller('HeaderCtrl', function ($state, apiController, modelManager, serverSideValidation, $timeout) {
this.changePasswordPressed = function() {
this.showNewPasswordForm = !this.showNewPasswordForm;
@@ -97,15 +97,15 @@ angular.module('app.frontend')
}
this.forgotPasswordSubmit = function() {
$auth.requestPasswordReset(this.resetData)
.then(function(resp) {
this.resetData.response = "Success";
// handle success response
}.bind(this))
.catch(function(resp) {
// handle error response
this.resetData.response = "Error";
}.bind(this));
// $auth.requestPasswordReset(this.resetData)
// .then(function(resp) {
// this.resetData.response = "Success";
// // handle success response
// }.bind(this))
// .catch(function(resp) {
// // handle error response
// this.resetData.response = "Error";
// }.bind(this));
}
this.encryptionStatusForNotes = function() {

View File

@@ -19,36 +19,36 @@ angular.module('app.frontend')
})
// Auth routes
.state('auth', {
abstract: true,
url: '/auth',
parent: 'base',
views: {
'content@' : {
templateUrl: 'frontend/auth/wrapper.html',
}
}
})
.state('auth.login', {
url: '/login',
templateUrl: 'frontend/auth/login.html',
})
.state('auth.forgot', {
url: '/forgot',
templateUrl: 'frontend/auth/forgot.html',
})
.state('auth.reset', {
url: '/reset?reset_password_token&email',
templateUrl: 'frontend/auth/reset.html',
controller: function($rootScope, $stateParams) {
$rootScope.resetData = {reset_password_token: $stateParams.reset_password_token, email: $stateParams.email};
// Clear reset_password_token on change state
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams, options) {
$rootScope.reset_password_token = null;
});
},
})
// .state('auth', {
// abstract: true,
// url: '/auth',
// parent: 'base',
// views: {
// 'content@' : {
// templateUrl: 'frontend/auth/wrapper.html',
// }
// }
// })
// .state('auth.login', {
// url: '/login',
// templateUrl: 'frontend/auth/login.html',
// })
// .state('auth.forgot', {
// url: '/forgot',
// templateUrl: 'frontend/auth/forgot.html',
// })
// .state('auth.reset', {
// url: '/reset?reset_password_token&email',
// templateUrl: 'frontend/auth/reset.html',
// controller: function($rootScope, $stateParams) {
// $rootScope.resetData = {reset_password_token: $stateParams.reset_password_token, email: $stateParams.email};
//
// // Clear reset_password_token on change state
// $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams, options) {
// $rootScope.reset_password_token = null;
// });
// },
// })
// 404 Error