Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit aff2c87

Browse files
authored
fix(top-app-bar): Should destroy ripple (#1355)
1 parent 7970289 commit aff2c87

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/top-app-bar/top-app-bar.directives.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import {
33
Component,
44
Directive,
55
ElementRef,
6-
Input
6+
Input,
7+
OnDestroy
78
} from '@angular/core';
89
import { MdcRipple } from '@angular-mdc/web/ripple';
910

@@ -50,13 +51,17 @@ export class MdcTopAppBarSection {
5051
},
5152
providers: [MdcRipple]
5253
})
53-
export class MdcTopAppBarActionItem {
54+
export class MdcTopAppBarActionItem implements OnDestroy {
5455
constructor(
5556
public elementRef: ElementRef<HTMLElement>,
5657
private _ripple: MdcRipple) {
5758

5859
_ripple.attachTo(this.elementRef.nativeElement, true);
5960
}
61+
62+
ngOnDestroy(): void {
63+
this._ripple.destroy();
64+
}
6065
}
6166

6267
@Directive({
@@ -68,7 +73,7 @@ export class MdcTopAppBarActionItem {
6873
},
6974
providers: [MdcRipple]
7075
})
71-
export class MdcTopAppBarNavigationIcon {
76+
export class MdcTopAppBarNavigationIcon implements OnDestroy {
7277
constructor(
7378
public elementRef: ElementRef<HTMLElement>,
7479
private _ripple: MdcRipple) {
@@ -80,6 +85,10 @@ export class MdcTopAppBarNavigationIcon {
8085
getHostElement() {
8186
return this.elementRef.nativeElement;
8287
}
88+
89+
ngOnDestroy(): void {
90+
this._ripple.destroy();
91+
}
8392
}
8493

8594
@Directive({

0 commit comments

Comments
 (0)