本文整理匯總了TypeScript中ng-zorro-antd.NzModalService.confirm方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript NzModalService.confirm方法的具體用法?TypeScript NzModalService.confirm怎麽用?TypeScript NzModalService.confirm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ng-zorro-antd.NzModalService
的用法示例。
在下文中一共展示了NzModalService.confirm方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: showConfirm
showConfirm(): void {
this.modalService.confirm({
nzTitle : '<i>Do you Want to delete these items?</i>',
nzContent: '<b>Some descriptions</b>',
nzOnOk : () => console.log('OK')
});
}
示例2: showConfirm
showConfirm(): void {
this.confirmModal = this.modal.confirm({
nzTitle: 'Do you Want to delete these items?',
nzContent: 'When clicked the OK button, this dialog will be closed after 1 second',
nzOnOk: () => new Promise((resolve, reject) => {
setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);
}).catch(() => console.log('Oops errors!'))
});
}
示例3: _click
@HostListener('click')
_click() {
this.confirmServ.confirm({
title: 'Make sure clear all local storage?',
onOk: () => {
localStorage.clear();
this.messageServ.success('Clear Finished!');
}
});
}
示例4: showDeleteConfirm
showDeleteConfirm(): void {
this.modalService.confirm({
nzTitle : 'Are you sure delete this task?',
nzContent : '<b style="color: red;">Some descriptions</b>',
nzOkText : 'Yes',
nzOkType : 'danger',
nzOnOk : () => console.log('OK'),
nzCancelText: 'No',
nzOnCancel : () => console.log('Cancel')
});
}
示例5: Observable
return new Observable((observer) => {
this.confirmSrv.confirm({
title: '確認要離開嗎?',
content: '你已經填寫了部分表單離開會放棄已經填寫的內容。',
okText: '離開',
cancelText: '取消',
onOk: () => {
observer.next(true);
observer.complete();
},
onCancel: () => {
observer.next(false);
observer.complete();
}
});
});