From a00e34254bf56482394df5cd6833be88288c0540 Mon Sep 17 00:00:00 2001 From: Eddie Lau 3dd13 Date: Fri, 15 Jan 2016 13:25:59 +0800 Subject: [PATCH] add ngOnDestroy to ion-icon and remove added css class --- ionic/components/icon/icon.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ionic/components/icon/icon.ts b/ionic/components/icon/icon.ts index 392a321637..879ce4d204 100644 --- a/ionic/components/icon/icon.ts +++ b/ionic/components/icon/icon.ts @@ -54,7 +54,7 @@ export class Icon { private _md: string = ''; private _css: string = ''; mode: string; - + constructor( config: Config, private _elementRef: ElementRef, @@ -70,11 +70,20 @@ export class Icon { } } + /** + * @private + */ + ngOnDestroy() { + if (this._css) { + this._renderer.setElementClass(this._elementRef, this._css, false); + } + } + @Input() get name() { return this._name; } - + set name(val) { if (!(/^md-|^ios-|^logo-/.test(val))) { // this does not have one of the defaults @@ -85,7 +94,7 @@ export class Icon { this.update(); } - @Input() + @Input() get ios(): string { return this._ios; }