From 06357dc441ce8932da85e85a2a03bf1df567fe77 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Tue, 1 Nov 2016 23:49:54 +0100 Subject: [PATCH] refactor(icon): improves logic for isActive --- src/components/icon/icon.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/icon/icon.ts b/src/components/icon/icon.ts index 7468400c1e..463c96d448 100644 --- a/src/components/icon/icon.ts +++ b/src/components/icon/icon.ts @@ -1,5 +1,6 @@ import { Directive, ElementRef, HostBinding, Input, Renderer } from '@angular/core'; +import { isTrueProperty } from '../../util/util'; import { Config } from '../../config/config'; import { Ion } from '../ion'; @@ -45,7 +46,7 @@ export class Icon extends Ion { /** @private */ _iconMode: string; /** @private */ - _isActive: any; + _isActive: boolean = true; /** @private */ _name: string = ''; /** @private */ @@ -145,11 +146,11 @@ export class Icon extends Ion { */ @Input() get isActive(): boolean { - return (this._isActive === undefined || this._isActive === true || this._isActive === 'true'); + return this._isActive; } set isActive(val: boolean) { - this._isActive = val; + this._isActive = isTrueProperty(val); this.update(); } @@ -178,7 +179,7 @@ export class Icon extends Ion { let iconMode = name.split('-', 2)[0]; if ( iconMode === 'ios' && - !this.isActive && + !this._isActive && name.indexOf('logo-') < 0 && name.indexOf('-outline') < 0) { name += '-outline';