我正在开发简单的日期选择器应用程序。我检查了相关的职位,但无法解决此错误。我正严格按照有角度的材料举例说明。请指导我。HTML文件
<mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
材料模块
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {MatDatepickerModule} from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatNativeDateModule } from '@angular/material/core';
@NgModule({
declarations: [],
imports: [
CommonModule,
MatDatepickerModule,
MatFormFieldModule,
MatNativeDateModule,
],
exports: [
MatDatepickerModule,
MatFormFieldModule,
MatNativeDateModule,
]
})
export class MaterialModule { }
您需要在模块的导入部分中添加MatInputModule
。