-
Notifications
You must be signed in to change notification settings - Fork 672
/
Copy pathmodal.component.ts
34 lines (29 loc) · 986 Bytes
/
modal.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { JsonPipe } from '@angular/common';
import { Component, Input, inject } from '@angular/core';
import { NzButtonModule } from 'ng-zorro-antd/button';
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
import { NzModalRef } from 'ng-zorro-antd/modal';
@Component({
selector: `app-demo-dialog-modal`,
template: `
<div class="modal-header">
<div class="modal-title">Custom component</div>
</div>
<p>参数:{{ record | json }}</p>
<div class="modal-footer">
<button nz-button [nzType]="'default'" [nzSize]="'large'" (click)="cancel()"> Cancel </button>
<button nz-button [nzType]="'primary'" [nzSize]="'large'" (click)="ok()"> OK </button>
</div>
`,
imports: [NzButtonModule, JsonPipe]
})
export class DemoModalComponent {
private readonly modal = inject(NzModalRef);
@Input() record: NzSafeAny;
ok(): void {
this.modal.destroy(`new time: ${+new Date()}`);
}
cancel(): void {
this.modal.destroy();
}
}