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

前端 未结 11 2287
隐瞒了意图╮
隐瞒了意图╮ 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条回答
  •  猫巷女王i
    2020-12-04 07:01

    If someone needs to call Dialog from services here is how to solve the issue. I agree with some of above answer, my answer is for calling dialog in services if someone may face issues on.

    Create a service for example DialogService then move your dialog function inside the services and add your dialogservice in the component you call like below code:

     @Component({
      selector: "app-newsfeed",
      templateUrl: "./abc.component.html",
      styleUrls: ["./abc.component.css",],
      providers:[DialogService]
    })
    

    otherwise you get error

提交回复
热议问题