According to the Component-First pattern, we should avoid the use of AngularJS controller.
Rule based on Angular 1.x
The following patterns are considered problems;
/*eslint angular/no-controller: 2*/
// invalid
angular.module('myModule').controller('HelloWorldController', function ($scope) {
$scope.text = 'Hello World';
}); // error: Based on the Component-First Pattern, you should avoid the use of controllers
The following patterns are not considered problems;
/*eslint angular/no-controller: 2*/
// valid
angular.module('myModule').directive('helloWorld', function () {
return {
template: '<div>{{ text }}',
controller: function ($scope) {
$scope.text = 'Hello World';
}
};
});
This rule was introduced in eslint-plugin-angular 0.9.0