"系统"对话框 角度材质



我为对话系统(角度材料(工作。

我为控制和容器对话创建对话服务。对话框服务具有用于打开/显示不同对话框的方法。

我为包含对话的数据创建了对话组件(它是对话的单个组件(。它是通用组件。

我添加堆栈闪电战

我在回调后关闭对话框时遇到问题。 回调后如何关闭对话框?我尝试使用 [mat-dialog-close] - 但我无法以某种方式参数化 - 启用和禁用不同按钮的[mat-dialog-close]。

而且问题不大。如何将动态垫子按钮添加到按钮元素?

(我添加了类"垫子按钮",但这并不完全模仿垫子按钮(

<div *ngIf="getButtons().length > 0 || getCloseButton()" mat-dialog-actions>
<ng-container *ngFor="let button of getButtons()">
<button [attr.class]="button.class"
(click)="button.callback(button.callbackItem || dialogForm)">{{button.title}}</button>
</ng-container>
</div>

在你的对话框中.html你必须有这样的东西:

<button mat-stroked-button (click)="closeDialog()">Close</button>

在你的对话框中:

import { Component, OnInit, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
@Component({
selector: 'dialog',
templateUrl: './dialog.component.html',
styleUrls: ['./dialog.component.scss']
})
export class DialogComponent implements OnInit {
constructor(public dialogRef: MatDialogRef<DialogComponent>) { }
ngOnInit() {
}
closeDialog() {
this.dialogRef.close();
}
}

最新更新