I know this question is duplicate (this). but I have problem.
I have added the MatDialogModule
in the import section of AppModule.
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
MatDialogModule,
MatButtonModule,
AppRoutingModule,
BrowserAnimationsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Content of my dialog :
<h2 mat-dialog-title>Install Angular</h2>
<mat-dialog-content class="mat-typography">
<h3>Develop across all platforms</h3>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button mat-dialog-close>Cancel</button>
<button mat-button [mat-dialog-close]="true" cdkFocusInitial>Install</button>
</mat-dialog-actions>
When I want to open dialog :
constructor(public dialog: MatDialog) {}
openDialog() {
const dialogRef = this.dialog.open(CourseAcitonComponent);
dialogRef.afterClosed().subscribe(result => {
console.log(`Dialog result: ${result}`);
});
}
I get the following Error :
1-
If 'mat-dialog-content' is an Angular component, then verify that it is part of this module.
2-
Can't bind to 'mat-dialog-close' since it isn't a known property of 'button'.
<button mat-button [mat-dialog-close]="true" cdkFocusInitial>Install</button>