-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
promise.ts
39 lines (34 loc) · 847 Bytes
/
promise.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
35
36
37
38
39
import { Component } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'nz-demo-popconfirm-promise',
template: `
<button
nz-popconfirm
nzPopconfirmTitle="Title"
[nzBeforeConfirm]="beforeConfirm"
(nzOnConfirm)="confirm()"
(nzOnCancel)="cancel()"
nz-button
nzType="primary"
>
Open Popconfirm with Promise
</button>
`
})
export class NzDemoPopconfirmPromiseComponent {
cancel(): void {
this.nzMessageService.info('click cancel');
}
confirm(): void {
this.nzMessageService.info('click confirm');
}
beforeConfirm(): Promise<boolean> {
return new Promise(resolve => {
setTimeout(() => {
resolve(true);
}, 3000);
});
}
constructor(private nzMessageService: NzMessageService) {}
}