我对用 typescript 编写的 AngularJS 服务有疑问。当我使用 Visual Studios WebDeply 将我的应用程序发布到 Azure Web 服务器时,我收到一条错误消息,告诉我
错误:未知提供者:localeServiceProvider <- localeService
当我在本地机器上发布它时,它工作正常。我能够找到的唯一区别是,在我的本地计算机上,应用程序加载了 .js 文件,而在 Azure 服务器上,它加载了 .js.map 文件。我认为这可能是问题所在。本地机器上引用的服务 (.js) 如下所示:
/// <reference path='../_all.ts' />
var blackbird;
(function (blackbird) {
'use strict';
/**
* Services that persists and retrieves localized strings from Web Api.
*/
var LocaleService = (function () {
function LocaleService($http, $log) {
this.$http = $http;
this.$log = $log;
}
LocaleService.prototype.injection = function () {
return [
'$http',
'$log',
LocaleService
];
};
LocaleService.prototype.get = function (successcb) {
this.$http({ method: 'GET', url: '/api/locales' }).success(function (data, status, headers, config) {
successcb(data);
}).error(function (data, status, headers, config) {
this.$log.warn(data, status, headers, config);
});
};
return LocaleService;
})();
blackbird.LocaleService = LocaleService;
})(blackbird || (blackbird = {}));
Azure 服务器上引用的服务 (.js) 如下所示:
/// <reference path='../_all.ts' />
var blackbird;
(function (blackbird) {
'use strict';
/**
* Services that persists and retrieves localized strings from Web Api.
*/
var LocaleService = (function () {
function LocaleService($http, $log) {
this.$http = $http;
this.$log = $log;
}
LocaleService.prototype.injection = function () {
return [
'$http',
'$log',
LocaleService
];
};
LocaleService.prototype.get = function (successcb) {
this.$http({ method: 'GET', url: '/api/locales' }).success(function (data, status, headers, config) {
successcb(data);
}).error(function (data, status, headers, config) {
this.$log.warn(data, status, headers, config);
});
};
return LocaleService;
})();
blackbird.LocaleService = LocaleService;
})(blackbird || (blackbird = {}));
//# sourceMappingURL=LocaleService.js.map
据我所知,它们看起来几乎相同,除了
//# sourceMappingURL=LocaleService.js.map
早些时候,我将 js.map 文件添加到项目中,以确保它们上传到服务器的位置,因为默认情况下它们不是在哪里,并且在发布应用程序时会出现错误要求它们。有人对如何解决这个问题有任何建议吗?