We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4032bfa commit 4d17a2eCopy full SHA for 4d17a2e
1 file changed
src/ref.ts
@@ -1,10 +1,10 @@
1
-import { Input, ElementRef, OnChanges } from '@angular/core';
+import { Input, ElementRef, OnChanges, OnDestroy } from '@angular/core';
2
import { Directive } from '@angular/core';
3
4
@Directive({
5
selector: '[refComponent]'
6
})
7
-export class RefDirective implements OnChanges {
+export class RefDirective implements OnChanges, OnDestroy {
8
@Input() data!: any
9
@Input() emit!: any
10
@@ -13,4 +13,8 @@ export class RefDirective implements OnChanges {
13
ngOnChanges() {
14
this.emit({ type: 'render', data: { ...this.data, element: this.el.nativeElement } })
15
}
16
+
17
+ ngOnDestroy() {
18
+ this.emit({ type: 'unmount', data: { element: this.el.nativeElement } })
19
+ }
20
0 commit comments