Use promise api for

This commit is contained in:
Tankred Hase 2014-11-09 17:34:48 +01:00
parent 074914044d
commit 93bd548b46
1 changed files with 4 additions and 2 deletions

View File

@ -20,7 +20,9 @@ var AddAccountCtrl = function($scope, $location, $routeParams, $http) {
var domain = $scope.emailAddress.split('@')[1];
var url = cfg.settingsUrl + domain;
$http.get(url).success(function(config) {
return $http.get(url).then(function(res) {
var config = res.data;
$scope.busy = false;
$scope.state.login = {
mailConfig: config,
@ -39,7 +41,7 @@ var AddAccountCtrl = function($scope, $location, $routeParams, $http) {
setCredentials();
}
}).error(function() {
}).catch(function() {
$scope.busy = false;
$scope.errMsg = 'Error fetching IMAP settings for that email address!';
});