Ng-zorro-antd: promise return false in Modal component can't stop [button ok] loading

Created on 17 Dec 2018  路  6Comments  路  Source: NG-ZORRO/ng-zorro-antd

Version

7.0.0-rc.1

Environment

any

Reproduction link

https://stackblitz.com/edit/angular-efvfiu?file=src/app/app.component.ts

Steps to reproduce

 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);
         setTimeout(() => {
           return false;
         }, 1000);
      }).catch(() => console.log('Oops errors!'))
    });

What is expected?

when I return false, the [loading status] in OK button should be removed and back to normal status

What is actually happening?

always loading

Other?

Most helpful comment

resolve(false)

All 6 comments

@xiehongyang Must be call resolve() in setTimeout if you hope closed.

@xiehongyang Must be call resolve() in setTimeout if you hope closed.

yes, I know that, both resolve() and reject() can close the modal, but now If I want keep the Modal open, I pass return false to stop the Modal close, the loading in button OK can't be removed, how could I remove the loading in that button

resolve(false)

resolve(false)
@cipchk 杩欎釜濂藉儚娌$敤,modal妗嗚繕鏄細娑堝け

@St-Yukio 浣犳柟娉曢噷鏄痯romise鍚楋紝鎴戣瘯杩囦簡锛屾槸鍙互闃绘 modal妗嗗叧闂殑

@St-Yukio 浣犳柟娉曢噷鏄痯romise鍚楋紝鎴戣瘯杩囦簡锛屾槸鍙互闃绘 modal妗嗗叧闂殑

@xiehongyang 鎴戠煡閬撳師鍥犱簡 璋㈣阿...

Was this page helpful?
0 / 5 - 0 ratings