Skip to content

Commit

Permalink
Merge pull request #104 from soldiercnorm/master
Browse files Browse the repository at this point in the history
(bugfix) Changed .success()/.error() to use .then() for http
  • Loading branch information
doshprompt committed Dec 8, 2016
2 parents 501d573 + e818bfd commit fc8ea15
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ angular.module('ngLocalize')
url += localeConf.fileExtension;

$http.get(url)
.success(function (data) {
.then(function (response) {
var key,
path = getPath(token);
path = getPath(token),
data = response.data;
// Merge the contents of the obtained data into the stored bundle.
for (key in data) {
if (data.hasOwnProperty(key)) {
Expand All @@ -132,8 +133,7 @@ angular.module('ngLocalize')
if (deferrences[path]) {
deferrences[path].resolve(path);
}
})
.error(function (err) {
}, function (err) {
var path = getPath(token);

$log.error('[localizationService] Failed to load: ' + url);
Expand All @@ -143,7 +143,7 @@ angular.module('ngLocalize')

// If we issued a Promise for this file, reject it now.
if (deferrences[path]) {
deferrences[path].reject(err);
deferrences[path].reject(err.data);
}
});
}
Expand Down

0 comments on commit fc8ea15

Please sign in to comment.