Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 1.2 KB

no-service-method.md

File metadata and controls

45 lines (28 loc) · 1.2 KB

no-service-method - use factory() instead of service()

You should prefer the factory() method instead of service()

Rule based on Angular 1.x

Styleguide Reference

Examples

The following patterns are considered problems;

/*eslint angular/no-service-method: 2*/

// invalid
angular.module('myModule').service('myService', function() {
    // ...
}); // error: You should prefer the factory() method instead of service()

The following patterns are not considered problems;

/*eslint angular/no-service-method: 2*/

// valid
angular.module('myModule').factory('myService', function () {
    // ...
});

// valid
angular.module('myModule').value('someValue', {
    // ...
});

Version

This rule was introduced in eslint-plugin-angular 0.1.0

Links