Open jbanulso opened 6 years ago
@jbanulso, component definitions (i.e. the object passed along to .component(...)
) shouldn't be injectable, thus this lint shouldn't concern them.
If a component need any dependencies, they should have them injected into the controller
property of the component.
How exactly are you defining your components?
@miqh I define my components like this (sometimes without the direct injection, either way doesn't work for me):
var DummyComponent = {
controller: DummyController,
templateUrl: 'dummy.component.html'
};
function DummyController($http) { }
DummyController.$inject = ['$http'];
angular
.module('DummyModule')
.component('dummy', DummyComponent);
Actually, I've just noticed that the same problem occurs with the di-order
rule (and maybe with others?), so I'll update the title of the issue.
I use it to detect
$http
and$resource
injections like this:However, it doesn't detect those injections in my components. I've even tried to configure the rule like this, with no luck either way:
EDIT: The rule
di-order
does not work either. This could potentially mean that other rules related to controllers might not work inside components.