From 191ea5102da831cd15a82d8ff6023eb747b55358 Mon Sep 17 00:00:00 2001 From: Lorenzo Iovino Date: Mon, 22 May 2017 12:29:03 +0200 Subject: [PATCH] quick fix activateOnInputevent --- src/ng2fittext.directive.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ng2fittext.directive.ts b/src/ng2fittext.directive.ts index 46bfb81..54958f7 100644 --- a/src/ng2fittext.directive.ts +++ b/src/ng2fittext.directive.ts @@ -49,8 +49,11 @@ export class Ng2FittextDirective implements AfterViewInit, OnInit { ngOnInit() { if (this.fittext) { - this.setFontSize(this.container.clientWidth); - this.el.nativeElement.style.setProperty('will-change', 'content'); + if(this.activateOnInputEvents) { + this.setFontSize(this.container.clientHeight); + } else { + this.setFontSize(this.container.clientWidth); + this.el.nativeElement.style.setProperty('will-change', 'content'); } }