-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ng.js
38 lines (36 loc) · 970 Bytes
/
index.ng.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
let $http = require('./src/$http');
let $resource = require('./src/$resource');
const MODULE_NAME = '$resource';
angular.module(MODULE_NAME, [])
.provider(MODULE_NAME, function () {
this.setResponseType = (value)=> {
$resource.responseType = value;
return this;
};
this.setHeaders = (value)=> {
$resource.headers = value;
return this
};
this.setWithCredentials = (value)=> {
$resource.withCredentials = value;
return this;
};
this.setHosts = (value)=> {
$resource.hosts = value;
return this;
};
this.setInterceptor = (func)=> {
$resource.interceptor = func;
return this;
};
this.setTransformHeaders = (func) => {
$resource.transformHeaders.push(func);
return this;
};
this.$get = ['$q', function ($q) {
$http.injector('$q', $q);
$resource.injector('$http', $http);
return $resource;
}]
});
export default MODULE_NAME;