Angular Material and Jasmine : “ No provider for InjectionToken MdDialogData! ”

前端 未结 6 2038
醉梦人生
醉梦人生 2021-02-01 12:12

I have a component which is meant to be used in an Angular Material MdDialog :

@Component({
  ...
})
export class MyComponent {

  constructor(@Inject(MD_DIALOG_         


        
6条回答
  •  暖寄归人
    2021-02-01 12:56

    I added this :

    providers: [
        { provide: MD_DIALOG_DATA, useValue: {} },
        { provide: MdDialogRef, useValue: {} }
    ]
    

    And it works :)

    Thanks for your help @methgaard!

提交回复
热议问题