-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule "no-life-cycle-call" does not allow for subclassing #573
Comments
IMHO, this |
@jscharett makes sense to me. @rafaelss95 would you want to check if the receiver of the method call isn't |
@rafaelss95: If I understand correctly, the issue you linked to is a bug where Angular does not call a lifecycle hook that is defined in a TypeScript mixin, not a base class which is what this issue is referring to. Angular cannot and should not call a super implementation of a lifecycle hook when it is overridden in a derived class. Consider the following: class BaseComponent {
ngOnInit() {
console.log('base component init');
}
}
@Component({...})
class MyComponent {
ngOnInit() {
super.ngOnInit();
console.log('my component init');
}
} The If you don't provide an implementation of |
It's a little bit strange because at some point it worked according to this issue. However, I've to agree with you, it makes sense to explicitly call using |
If both classes are decorated, it works differently. I'm not sure of the exact behavior when the base component class is decorated, though. |
If I extend a component and I override a lifecycle hook, this rule prevents me from calling the super method. While I agree with the premise of the rule, it should, however, allow me to call the super method when overriding.
The text was updated successfully, but these errors were encountered: