-
Notifications
You must be signed in to change notification settings - Fork 131
/
di.js
69 lines (58 loc) · 2.69 KB
/
di.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// example - valid: true
angular.module('myModule').factory('myService', function ($http, $log, anotherService) {
// ...
});
// example - valid: false, errorMessage: "You should use the function syntax for DI"
angular.module('myModule').factory('myService', ['$http', '$log', 'anotherService', function ($http, $log, anotherService) {
// ...
}]);
// example - valid: true, options: ["array"]
angular.module('myModule').factory('myService', ['$http', '$log', 'anotherService', function ($http, $log, anotherService) {
// ...
}]);
// example - valid: true, options: ["array", {matchNames: false}]
angular.module('myModule').factory('myService', ['eslintService', function (service) {
// ...
}]);
// example - valid: true, options: ["$inject"]
angular.module('myModule').factory('myService', myServiceFn);
myServiceFn.$inject=['$http', '$log', 'anotherService'];
function myServiceFn($http, $log, anotherService) {
// ...
}
// example - valid: true, options: ["$inject", {matchNames: false}]
angular.module('myModule').factory('myService', myServiceFn);
myServiceFn.$inject=['eslintService'];
function myServiceFn(Service) {
// ...
}
// example - valid: false, options: ["array"], errorMessage: "The signature of the method is incorrect"
angular.module('myModule').factory('myService', ['$http', '$log', 'anotherService', function ($http, $log) {
// ...
}]);
// example - valid: false, options: ["array"], errorMessage: "You have an error in your DI configuration. Each items of the array should match exactly one function parameter"
angular.module('myModule').factory('myService', ['$http', '$log', function ($log, $http) {
// ...
}]);
// example - valid: false, options: ["array"], errorMessage: "The signature of the method is incorrect"
angular.module('myModule').factory('myService', ['$http', function ($http, $log) {
// ...
}]);
// example - valid: false, options: ["$inject"], errorMessage: "The signature of the method is incorrect"
angular.module('myModule').factory('myService', myServiceFn);
myServiceFn.$inject=['$http', '$log', 'anotherService'];
function myServiceFn($http, $log) {
// ...
}
// example - valid: false, options: ["$inject"], errorMessage: "The signature of the method is incorrect"
angular.module('myModule').factory('myService', myServiceFn);
myServiceFn.$inject=['$http', '$log'];
function myServiceFn($http, $log, anotherService) {
// ...
}
// example - valid: false, options: ["$inject"], errorMessage: "You have an error in your DI configuration. Each items of the array should match exactly one function parameter"
angular.module('myModule').factory('myService', myServiceFn);
myServiceFn.$inject=['$log', '$http'];
function myServiceFn($http, $log) {
// ...
}