Closed
Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
Yes
Description
When a component has a button with click handler and ngIf it won't be destroyed after user click
Please provide a link to a minimal reproduction of the bug
https://github.com/s3141p/Ng-leak
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in
Angular CLI: 12.1.1
Node: 14.15.1
Package Manager: npm 6.14.8
OS: linux x64
Angular: 12.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1201.1
@angular-devkit/build-angular 12.1.1
@angular-devkit/core 12.1.1
@angular-devkit/schematics 12.1.1
@schematics/angular 12.1.1
rxjs 6.6.7
typescript 4.2.4
Anything else?
To reproduce:
- Clone the repo
ng serve
- Click on
To B Component
link - Click on
B button
(!! Important step) - Make Memory snapshot
- Click on
To A Component
- Run GC
- Make Memory snapshot
Last snapshot will show that BComponent
wasn't destroyed.