mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
onDestroy needed for broadcast subscriptions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Component,
|
||||
ComponentFactoryResolver,
|
||||
OnDestroy,
|
||||
NgZone,
|
||||
ViewChild,
|
||||
ViewContainerRef,
|
||||
@@ -31,7 +32,7 @@ const BroadcasterSubscriptionId = 'LoginComponent';
|
||||
selector: 'app-login',
|
||||
templateUrl: 'login.component.html',
|
||||
})
|
||||
export class LoginComponent extends BaseLoginComponent {
|
||||
export class LoginComponent extends BaseLoginComponent implements OnDestroy {
|
||||
@ViewChild('environment', { read: ViewContainerRef, static: true }) environmentModal: ViewContainerRef;
|
||||
|
||||
showingModal = false;
|
||||
@@ -63,6 +64,10 @@ export class LoginComponent extends BaseLoginComponent {
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||
}
|
||||
|
||||
settings() {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||
const modal = this.environmentModal.createComponent(factory).instance;
|
||||
|
||||
Reference in New Issue
Block a user