0
我使用此構建角度庫Generator當我從應用程序調用它們時,庫的所有功能都正常工作,但是使HTTP
調用的功能無法正常工作。是否有任何理由阻止從Angular庫調用HTTPS
!角度庫沒有製作HTTP調用
這裏是庫代碼的代碼示例:
(function (angular) {
// Create all modules and define dependencies to make sure they exist
// and are loaded in the correct order to satisfy dependency injection
// before all nested files are concatenated by Gulp
// Config
angular.module('myLib.config', [])
.value('myLib.config', {
debug: true
});
// Modules
angular.module('myLib.directives', []);
angular.module('myLib.services', []);
angular.module('myLib',
[
'myLib.config',
'myLib.directives',
'myLib.services'
]);
})(angular);
(function (angular) {
'use strict';
angular.module('myLib.services', [])
.factory('myLib', myLib);
myLib.$inject = ['$http', '$rootScope'];
function myLib($http, $rootScope) {
var myLibrary = {};
myLibrary.register = function() {
$http({
method: 'POST',
url: 'url',
data: {id: '00000000000'},
headers: {'Authorization': 'Basic ' + credentialsEncoded}
});
};
return myLibrary;
}
})(angular);
當我試圖調用寄存器功能HTTP調用不作出然而,調用另一個功能是工作的罰款。
你是否縮小了你的庫? –
你能說清楚你的意思嗎?任何代碼示例? –
是的,但我也試過未縮小版本 – user1920302