Angular Material component not working: 'mat-option' is not a known element

后端 未结 3 1553
被撕碎了的回忆
被撕碎了的回忆 2021-01-17 10:58

I am trying to add angular material component. but the component did not work properly. that error said

Uncaught Error: Template parse errors: \'mat-option\         


        
3条回答
  •  清歌不尽
    2021-01-17 11:34

    You need to import MatSelectModule cause mat-option are declared inside this module and add this into the AppModule imports

    import { ..., MatSelectModule, ... } from '@angular/material';
    
    @NgModule({
       imports: [ ..., MatSelectModule, ...]
    })
    export class AppModule { }
    

提交回复
热议问题