angular - 浏览器控制台中的错误 mat-form-field 必须包含 MatFormFieldControl
问题描述
我正在使用 Angular 9 和 Angular 材料 9.2.4 我正在尝试使用 MatFormField。下面是我的 app.module.ts
@NgModule({
declarations: [
AppComponent,
LoginComponent,
RegisterComponent
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
MatToolbarModule,
MatFormFieldModule,
MatInputModule
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule { }
这是我的 component.html
<p>
<mat-form-field appearance="standard">
<mat-label>Standard form field</mat-label>
<input matInput placeholder="Placeholder">
<mat-hint>Hint</mat-hint>
</mat-form-field>
</p>
但我的表格字段看起来像
我在控制台中有错误。请建议我在配置中缺少什么
解决方案
尝试在您的导入中导入FormsModule
推荐阅读
- javascript - 在同一窗口(FireFox 和 IE)上侦听 localStorage.setItem
- shell - 是否有使用 Shell 从文本文件中提取随机行的功能?
- c++ - 使用 const char 创建对象时使用 std::make_unique 时出现链接错误 *
- crystal-reports - 如何重置字符串数组变量
- javascript - 以下函数的大 O 是什么:
- sql - 如何在vertica中查询已关闭的会话
- vue.js - 在 VueJS 中有一种方法可以在构建步骤期间将环境变量或配置值读入静态/文件
- amazon-web-services - AWS CodePipeline - 权限不足无法访问工件错误
- python - 用散点矩阵绘制 2 个数据集
- python - 如何通过将鼠标悬停在散景中的不同字形上来更改字形组的颜色?或显示描述关系的线条