當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ng-zorro-antd.NzModalService類代碼示例

本文整理匯總了TypeScript中ng-zorro-antd.NzModalService的典型用法代碼示例。如果您正苦於以下問題:TypeScript NzModalService類的具體用法?TypeScript NzModalService怎麽用?TypeScript NzModalService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了NzModalService類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

 constructor(modalSrv: NzModalService) {
   modalSrv.closeAll();
 }
開發者ID:jijiechen,項目名稱:openaspnetorg,代碼行數:3,代碼來源:500.component.ts

示例2: constructor

 constructor(private router: Router, modalSrv: NzModalService) {
     modalSrv.closeAll();
 }
開發者ID:wexz,項目名稱:delon,代碼行數:3,代碼來源:login.component.ts

示例3: 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')
   });
 }
開發者ID:SrgGs,項目名稱:ng-zorro-antd,代碼行數:7,代碼來源:confirm.ts

示例4: info

 info(): void {
   this.modalService.info({
     nzTitle: 'This is a notification message',
     nzContent: '<p>some messages...some messages...</p><p>some messages...some messages...</p>',
     nzOnOk: () => console.log('Info OK')
   });
 }
開發者ID:fengyongqing,項目名稱:ng-zorro-antd,代碼行數:7,代碼來源:info.ts

示例5: open

 /**
  * 打開對話框,默認會過濾一些事件的回調,因此更容易處理回調:
  * this.modalHelper.open(FormEditComponent, { i }).subscribe(res => this.load());
  *
  * 對於組件的成功&關閉的處理說明:
  * 成功:
  * this.subject.destroy('onOk');
  *  若需要回調用參數則:
  *  this.subject.next(data);
  *  this.subject.destroy();
  *
  * 關閉:
  * this.subject.destroy();
  *
  * @param {*} comp 組件
  * @param {*} [params] 組件參數
  * @param {('sm' | 'lg' | '' | number)} [size='lg'] 大小;例如:lg、600,默認:lg
  * @param {*} [options] 對話框ConfigInterface參數
  */
 open(comp: any, params?: any, size: 'sm' | 'lg' | '' | number = 'lg', options?: any): Observable<any> {
     let cls = '', width = '';
     if (size) {
         if (typeof size === 'number') {
             width = `${size}px`;
         } else {
             cls = `modal-${size}`;
         }
     }
     return this.modalSrv
         .open(Object.assign({
             wrapClassName: cls,
             content: comp,
             width: width ? width : undefined,
             footer: false,
             componentParams: params
         }, options || {}))
         .pipe(filter((res: any) => {
             let findIdx = -1;
             if (typeof res === 'string') {
                 const resStr = res as string;
                 findIdx = ['onShow', 'onShown', 'onHide', 'onHidden', 'onCancel', 'onDestroy'].findIndex(w => resStr.startsWith(w));
             }
             return findIdx === -1;
         }));
 }
開發者ID:ezhuo,項目名稱:angular-admin-ng-zorro,代碼行數:45,代碼來源:modal.service.ts

示例6: success

  success(): void {
    const modal = this.modalService.success({
      nzTitle: 'This is a notification message',
      nzContent: 'This modal will be destroyed after 1 second'
    });

    window.setTimeout(() => modal.destroy(), 1000);
  }
開發者ID:SrgGs,項目名稱:ng-zorro-antd,代碼行數:8,代碼來源:manual.ts

示例7: 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!'))
   });
 }
開發者ID:SrgGs,項目名稱:ng-zorro-antd,代碼行數:9,代碼來源:confirm-promise.ts

示例8: catchError

 catchError((err: HttpResponse<any>, caught: Observable<any>) => { // 返回異常
   if (err.status === 401) {
     this.confirmSrv.warning({
       nzTitle: '提示',
       nzContent: '登錄超時,請重新登錄!',
       nzOnOk: () => { }
     });
   }
   return Observable.create(observer => observer.next(event));
 })
開發者ID:zmlovelin,項目名稱:tools,代碼行數:10,代碼來源:noop-interceptor.ts

示例9:

 @HostListener('click')
 _click() {
     this.confirmServ.confirm({
         title: 'Make sure clear all local storage?',
         onOk: () => {
             localStorage.clear();
             this.messageServ.success('Clear Finished!');
         }
     });
 }
開發者ID:staneee,項目名稱:ABPTemplateUI-ng-alain,代碼行數:10,代碼來源:storage.component.ts

示例10: 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')
   });
 }
開發者ID:SrgGs,項目名稱:ng-zorro-antd,代碼行數:11,代碼來源:confirm.ts

示例11: view

 public view(profile: Contact) {
     const modal = this.modalService.create({
         nzTitle: null,
         nzFooter: null,
         nzClassName: 'card-modal',
         nzMaskStyle: {backgroundColor: 'transparent'},
         nzContent: ProfileComponent,
         nzComponentParams: {
             profile: profile
         }
     });
 }
開發者ID:yangjinguang,項目名稱:liyu,代碼行數:12,代碼來源:profile.service.ts

示例12: Observable

 return new Observable((observer) => {
     this.confirmSrv.confirm({
         title: '確認要離開嗎?',
         content: '你已經填寫了部分表單離開會放棄已經填寫的內容。',
         okText: '離開',
         cancelText: '取消',
         onOk: () => {
             observer.next(true);
             observer.complete();
         },
         onCancel: () => {
             observer.next(false);
             observer.complete();
         }
     });
 });
開發者ID:duxie,項目名稱:ng-alain,代碼行數:16,代碼來源:can-leave.provide.ts

示例13: successHandle

 this.tenantApi.listCurrent().subscribe(tenants => {
     console.log(tenants.data);
     if (tenants.data.length <= 0) {
         this.message.error('未綁定租戶');
         return;
     }
     if (tenants.data.length <= 1) {
         successHandle(tenants.data[0]);
     } else {
         const modal = this.modal.create({
             nzTitle: '選擇公司',
             nzWidth: '521px',
             nzContent: LoginTenantSelectComponent,
             nzComponentParams: {
                 tenants: tenants.data
             },
             nzFooter: null
         });
         modal.afterClose.subscribe((t: Tenant) => {
             successHandle(t);
         });
     }
 });
開發者ID:yangjinguang,項目名稱:liyu,代碼行數:23,代碼來源:login.component.ts

示例14: warning

 warning(): void {
   this.modalService.warning({
     nzTitle: 'This is an warning message',
     nzContent: 'some messages...some messages...'
   });
 }
開發者ID:fengyongqing,項目名稱:ng-zorro-antd,代碼行數:6,代碼來源:info.ts

示例15: error

 error(): void {
   this.modalService.error({
     nzTitle: 'This is an error message',
     nzContent: 'some messages...some messages...'
   });
 }
開發者ID:fengyongqing,項目名稱:ng-zorro-antd,代碼行數:6,代碼來源:info.ts


注:本文中的ng-zorro-antd.NzModalService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。