Angular - MatDialogRef
父组件
import { MatDialog } from '@angular/material/dialog';
import { someOneDialogComponent} from './dialogs/someOne-dialog.dialog';
------constructor(private _dialog: MatDialog,
-------------------------------------
const config = someOneDialogComponent.config,config.data.params = appUtil.filterParams(params);// someOneDialogComponent 是弹窗组件,此动作是给弹窗内传值,并打开弹窗let dialogRef = this._dialog.open(someOneDialogComponent, config);dialogRef.afterClosed().subscribe((result: any) => {// 监听弹窗关闭并拿到弹窗传回的值if (result) {// ------dialogRef = null;});
someOneDialogComponent
import {MAT_DIALOG_DATA,MatDialogConfig,MatDialogRef,
} from '@angular/material/dialog'export class SomeOneDialogComponentimplements OnInit {public static config: MatDialogConfig = {disableClose: false,width: '1000px',minHeight: '500px',data: {assignationShareType: 0,shares: [],},};// 上面代码穿过来的值-------constructor(public dialogRef: MatDialogRef<SomeOneDialogComponentimplements >,--------this.dialogRef.close(res);
// 将值传给调用它的父组件
-----
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!