Template parse errors: 'md-form-field' is not a known element

前端 未结 3 1218
情歌与酒
情歌与酒 2020-12-05 09:27

I am using Angular 4 and Angular Material 2. For the following code :

3条回答
  •  感动是毒
    2020-12-05 10:05

    If you are finding difficulties importing files then just you can have one methodology to import.

    First import any required components in your .component.ts

    And import the specific module in your module .module.ts

    And then add it in imports in @NgModule ({ imports : [ Module ] })

    Example you want to import formcontrols just in you angular application

    1). app.component.ts

    `import { FormGroup, FormControl } from '@angular/forms'`
    

    2). app.module.ts

    import { FormsModule } from '@angular/forms'

    below in app.module.ts in

    @NgModule ({ imports : [ FormsModule ] })

提交回复
热议问题