首页 文章

matTextareaAutosize在Angular Material 6.4.2中不起作用

提问于
浏览
0

我正在尝试在角度材料6.4.2上的textarea上应用自动调整大小,如下所示 -

<mat-form-field>
      <textarea matInput [matTextareaAutosize]="true" placeholder="Task description" formControlName="description" [errorStateMatcher]="ErrorMatcher">
       </textarea>
</mat-form-field>

但它抛出以下错误:无法绑定到'matTextareaAutosize',因为它不是'textarea'的已知属性

我的代码有什么问题?

1 回答

  • 0

    在你 app.moudle

    import {  MatInputModule } from '@angular/material';
    

    然后将 MatInputModule 添加到 app.moudle 导入中

相关问题