NullInjectorError: No provider for MatDialog - trying to create a wrapper service for MatDialog

This error means you haven't included the Material Dialog module in your application, so there is no provider.

In your app.module.ts, ensure you have added MatDialogModule to your imports.

@NgModule({
  declarations: [
    AppComponent,
    ...
  ],
  imports: [
    MatDialogModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})

For future reference, you need to include the module for any Material component you are using. Check the documentation for each to find out which module you need (although most are self explanatory)


For future reference: if someone stumbles upon this question while testing, add MatDialogModule to the test imports.

beforeEach(async () => {
  TestBed.configureTestingModule({
    imports: [
      MatDialogModule,
    ],
...