一、引入對話框模塊
import {MatDialogModule} from '@angular/material'; 並在import中聲明。
二、使用
1.對話框組件
mat-dialog-title:對話框元素的標題。 滾動時保持固定在對話框頂部。
mat-dialog-content:對話框的可滾動內容容器。
mat-dialog-actions:對話框中底部操作按鈕的容器。 滾動時固定在底部。
2.需要打開對話框的組件
import {MatDialog} from '@angular/material/dialog';

3.對話框組件接收數據、回傳數據
import {MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';

效果: