eslint-plugin-angular
Version:
ESLint rules for AngularJS projects
22 lines (18 loc) • 774 B
JavaScript
// 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: ["$inject"]
angular.module('myModule').factory('myService', myServiceFn);
myServiceFn.$inject=['$http', '$log', 'anotherService'];
function myServiceFn($http, $log, anotherService) {
// ...
}