I want to check the width and height of <textarea>
as I resize it in real time not after I release the click so I tried to use Angular-resize-event. But its not working out it seems like this is only applicable to <div>
not <textarea>
. I also tried to wrap<textarea>
in<div>
but this does not work only the Height parameter changes but the width remains same . Why is it so ? Is there another way to do this ?
her is my code :
HTML
<div (resized)='onResize($event)'><textarea #resizable></textarea>
</div>
<div><span> HEIGHT : {{height}} </span> WIDTH : {{width}} </div>
Component.ts
import { Component, ViewChild, ElementRef } from '@angular/core';
import { ResizedEvent } from 'angular-resize-event';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
@ViewChild('resizable') box: ElementRef ;
onResize(event:ResizedEvent) {
this.height = event.newHeight;
this.width = event.newWidth;
}
}