resize() { this.elementRef.nativeElement.style.height = '4px'; this.elementRef.nativeElement.style.height = this.elementRef.nativeElement.scrollHeight + 'px'; } code example

Example: resize() { this.elementRef.nativeElement.style.height = '4px'; this.elementRef.nativeElement.style.height = this.elementRef.nativeElement.scrollHeight + 'px'; }

<textarea (keyup)="autoGrowTextZone($event)"></textarea>

autoGrowTextZone(e) {
  e.target.style.height = "0px";
  e.target.style.height = (e.target.scrollHeight + 25)+"px";
}

Tags:

Misc Example