-
Notifications
You must be signed in to change notification settings - Fork 26.2k
ngOnDestroy not firing when provide is an abstract class #14821
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
Comments
ngOnDestroy
not firing when provide
is an abstract class
Is there a workaround for this? |
what status of this? |
The problem is still reproduced on v 6.1.0 where it was fixed. |
Prepared example on v 7.0.1 to show the problem - https://stackblitz.com/edit/angular-qxrald Click the "toggle" button one or many times It may cause memory leaks, i guess. |
Confirmed, #23755 is only for NgModule providers, but didn't fix the Directive providers cases. |
Any update on this issue? |
Any update on this issue? |
Is this bug active for almost two years now or did I saw something wrong? Edit: Yes I saw something wrong. It is almost 3 years. |
This is a real View Engine bug. See updated Stackblitz with v9 here: The https://stackblitz.com/edit/angular-ivy-bsnzpz?file=src/app/hello.component.ts |
@kara this also happens when the service is provided locally using a factory. And it is not fixed by ivi. Or that is another bug? |
Closing this ticket since it was marked as ViewEngine-specific and ViewEngine is deprecated. Please reopen if the problem still exists in the latest version of Angular (powered by Ivy). |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a ... (check one with "x")
Current behavior
When specifying a provider where
provide
is an abstract class anduseClass
is a concrete one,ngOnDestroy
will never be called in the concrete class.Expected behavior
ngOnDestroy
should be called.Minimal reproduction of the problem with instructions
https://plnkr.co/edit/eIs7pjvldhcFrMmaJ4IV?p=preview
What is the motivation / use case for changing the behavior?
Providing abstract classes with concrete implementations that utilize
ngOnDestroy
to do cleanup.Please tell us about your environment:
Language: TypeScript 2.0
Node (for AoT issues):
node --version
=The text was updated successfully, but these errors were encountered: