我有一个
<mat-form-field class="mat-form-field mat-form-field--no-padding" appearance="outline" color="Primary">
<textarea (keyup.enter)="onKey($event, formGroupDirective)" matInput placeholder="do something" type="text" formControlName="message" required
cdkTextareaAutosize #autosize="cdkTextareaAutosize" cdkAutosizeMinRows="1"
cdkAutosizeMaxRows="5"></textarea>>
onKey(event, formGroupDirective: FormGroupDirective) {
event.preventDefault()
this.doSomething(formGroupDirective)
}
答案 0 :(得分:0)
https://stackoverflow.com/a/40656449/7037600
似乎输入也由表单处理。在实施上方链接中列出的解决方案后,问题得到解决。