angular的一个弹框弹出方法

写一个正常的component,然后用类似下面的方法弹出:

private readonly modalService = inject(NzModalService);

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 打开弃样操作模态框
openDiscardModal(): void {
const modalRef = this.modalService.create({
nzTitle: '随机抽样',
nzContent: AppsSampleManagementConfigComponent,
nzData: {
// codeTip: '化验码', // 传递自定义的编码提示文本
coalSampleTypeSetting: '21',
coalSampleTypeData: ['21', '22', '31', '61', '62'],
showTestProjectOptions: true
},

nzWidth: '90vw',
nzOnOk: (e: any) => {
console.log('nzOnOk triggered');
// this.randomSample(e);
},
nzOnCancel: () => {
console.log('Modal cancelled');
}
});
}