【发布时间】:2018-11-30 18:07:03
【问题描述】:
我对 textarea 有问题,如果我修改 textarea 上的内容并且(更改)被触发,它不会通过代码更改 textarea 的内容。
这是一个例子:
app.component.html
<textarea #content (change)="dosomething(content.value)">{{ thecontents | json }}</textarea>
app.component.ts
内容;
dosomething(data) {
// this will overwrite whatever is already in the textarea
this.thecontents = { something : 'someother'};
}
由于某种原因,当(change) 被触发时,文本区域没有被更改
为什么?我该如何解决这个问题?
【问题讨论】:
-
尝试(keyup)而不是(更改)。
标签: angular typescript angular6