Angular Material and Jasmine : “ No provider for InjectionToken MdDialogData! ”
问题 I have a component which is meant to be used in an Angular Material MdDialog : @Component({ ... }) export class MyComponent { constructor(@Inject(MD_DIALOG_DATA) public data: any, public dialogRef: MdDialogRef<MyComponent>) { ... } } I am trying to Unit Test it with Jasmine : describe('MyComponent', () => { let component: MyComponent; let fixture: ComponentFixture<MyComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ SharedTestingModule, ], declarations: [