我收到了许多类似的问题,但没有人与此有关。
'use strict'
var module = angular.module('TranslationModule', []);
module.service('TranslationSevice', function (dataService, $location) {
this.translationsDictionary;
var getTranslationsDictionary = function () {
return dataService('Translations?culture=' + $location.search().culture).get(function (data) {
try {
this.translationsDictionary = data;
}
catch (ex) {
console.log('Error!', ex);
}
});
}
getTranslationsDictionary();
});
答案 0 :(得分:0)
尝试:
return dataService('Translations?culture=' + $location.search().culture).get(function (data) {
try {
this.translationsDictionary = data;
}
catch (ex) {
console.log('Error!', ex);
}
}.bind(this);