我在使用打字腳本編寫AngularJS服務時遇到問題。 當我使用視覺工作室WebDeply要發佈我的應用程序的Web服務器Azure中我得到一個錯誤,告訴我,Typescript AngularJS服務無法在WebDeploy上運行到Azure
Error: Unknown provider: 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 = {}));
,服務(.js文件),這是Azure的服務器上引用如下:
/// <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文件到該項目,以確保他們在那裏上傳到服務器,因爲他們在那裏不是默認和發佈時應用程序給出了錯誤要求。 任何人有任何建議如何解決這個問題?