简体   繁体   English

什么是Textarea中的Angular4“Change”事件触发器指令

[英]What is the Angular4 “Change” event trigger directive in Textarea

Here is one of the versions that I tried INSIDE TEXTAREA: (change)="dosomething($event)" 这是我试过的其中一个版本INSIDE TEXTAREA :(更改)=“​​dosomething($ event)”

and it's not doing anything. 而且它没有做任何事情。 What is the directive for "change"? “改变”的指令是什么?

You should be using ngModelChange 您应该使用ngModelChange

   <textarea cols="25" [ngModel]="data" (ngModelChange)="doSomething($event)"></textarea>

LIVE DEMO 现场演示

Update: 更新:

(change) event will work in textarea but it is triggered on blur and text changed inside the text area (change)事件将在textarea中工作,但它会在文本区域内的模糊和文本更改时触发

DEMO DEMO

(改变)对我来说也不起作用,尝试(输入)它完美地工作:

<textarea [(ngModel)]="mytext" (input)="autoGrow($event)"></textarea>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM