StaticInjectorError (AppModule) [ProjectListComponent-> MdDialog]

using MdDialog to report errors, do you need dependency injection in AppModule?

TS code snippet:

import { MdDialog } from "@angular/material";

constructor(private dialog: MdDialog) { }

openNewProjectDialog() {
    this.dialog.open(NewProjectComponent);
}

error prompt:

`core.js:1449 ERROR Error: Uncaught (in promise): Error: StaticInjectorError (AppModule) [ProjectListComponent-> MdDialog]:
StaticInjectorError (Platform: core) [ProjectListComponent-> MdDialog]:

NullInjectorError: No provider for MdDialog!

Error: StaticInjectorError (AppModule) [ProjectListComponent-> MdDialog]:
StaticInjectorError (Platform: core) [ProjectListComponent-> MdDialog]:

NullInjectorError: No provider for MdDialog!`
Mar.28,2021

import {MatDialogModule} from'@ angular/material/dialog'

Menu