fix(ivy): destroy injector when module is destroyed (#27793)
Destroys the module's injector when an `NgModule` is destroyed which in turn calls the `ngOnDestroy` methods on the instantiated providers. This PR resolves FW-739. PR Close #27793
This commit is contained in:

committed by
Alex Rickabaugh

parent
2b9cc8503d
commit
ab2bf83398
@ -213,6 +213,7 @@ export class DowngradeComponentAdapter {
|
||||
}
|
||||
|
||||
registerCleanup() {
|
||||
const testabilityRegistry = this.componentRef.injector.get(TestabilityRegistry);
|
||||
const destroyComponentRef = this.wrapCallback(() => this.componentRef.destroy());
|
||||
let destroyed = false;
|
||||
|
||||
@ -220,8 +221,7 @@ export class DowngradeComponentAdapter {
|
||||
this.componentScope.$on('$destroy', () => {
|
||||
if (!destroyed) {
|
||||
destroyed = true;
|
||||
this.componentRef.injector.get(TestabilityRegistry)
|
||||
.unregisterApplication(this.componentRef.location.nativeElement);
|
||||
testabilityRegistry.unregisterApplication(this.componentRef.location.nativeElement);
|
||||
destroyComponentRef();
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user