ReferenceError:未定义MatInputModule

时间:2019-04-08 06:42:18

标签: angular angular-material

当我尝试在MatInputModule的{​​{1}}中使用imports时出现此错误

  

ReferenceError:未定义MatInputModule

我的app.module.ts文件如下:

@Ngmodule

example.component.html是:

import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
import { MatFormFieldModule } from '@angular/material/form-field';
@NgModule({


declarations: [..],
imports: [...,
    MatDatepickerModule, 
    MatNativeDateModule,
    MatFormFieldModule,
    MatInputModule    //<-----the error is generated when i add this 
  ],
  providers: [ ..., MatDatepickerModule],

example.component.ts是:

<mat-form-field>
  <label class="col-md-4">attended date</label>
  <input mdInput [matDatepicker]="mydatePicker">
  <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
  <mat-datepicker #mydatePicker></mat-datepicker>
</mat-form-field>

0 个答案:

没有答案