@Directive({
selector: 'textarea[appText]'
})
export class TextDirective {
@Output() public hasScrollBar = new EventEmitter<boolean>();
constructor(private readonly elRef: ElementRef<HTMLTextAreaElement>) {}
@HostListener('change')
@HostListener('input')
public changes() {
const elem = this.elRef.nativeElement;
this.hasScrollBar.emit(elem.clientHeight < elem.scrollHeight);
}
}
<textarea appText (hasScrollBar)="print($event)"></textarea>