Angular2 material dialog has issues - Did you add it to @NgModule.entryComponents?

前端 未结 11 2305
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 06:37

I am trying to follow the docs on https://material.angular.io/components/component/dialog but I cannot understand why it has the below issue?

I added the below on my

11条回答
  •  广开言路
    2020-12-04 06:56

    You need to add dynamically created components to entryComponents inside your @NgModule

    @NgModule({
      declarations: [
        AppComponent,
        LoginComponent,
        DashboardComponent,
        HomeComponent,
        DialogResultExampleDialog        
      ],
      entryComponents: [DialogResultExampleDialog]
    

    Note: In some cases entryComponents under lazy loaded modules will not work, as a workaround put them in your app.module (root)

提交回复
热议问题