2
这是我的服务看起来像
(function(){
'use strict';
angular.module('gls.service', [])
.config(config)
.service('popup', popup)
.service('API', api);
/* Config */
config.$inject = ['$httpProvider'];
function config($httpProvider) {
delete $httpProvider.defaults.headers.common['X-Requested-With'];
$httpProvider.defaults.headers.get = {
'Content-Type': 'application/json'
};
$httpProvider.defaults.headers.post = {
'Content-Type': 'application/json'
};
$httpProvider.defaults.headers.put = {
'Content-Type': 'application/json'
};
}
后跟弹出和API服务的功能。 如何测试config($httpProvider)
函数?我正在用离子形式运行用户界面。请建议beforeEach()区域来定义.config
。 它与$ httpBackend有什么关系?