ngx-modialog icon indicating copy to clipboard operation
ngx-modialog copied to clipboard

respond to callback from confirm

Open d4e666 opened this issue 8 years ago • 4 comments

IMPORTANT: Please provide a sample using:

  • **I'm submitting a question **
  • What is the current behavior? I copied code from your code editor into VS2015 Code, and is all works fine. I notice that the "open" method returns what looks like a Promise, but when I provide the promisse with function references, I get the error "Cannot read property 'fn' of undefined".

I provided the functions in the following ways, but neither work

this.modal.confirm() .size('sm') .isBlocking(true) .showClose(true) .keyboard(27) .title('Are you sure?') .body('Are you sure you want to delete "User" from that file?') .open().then(function () { this.showSuccess }, function () { this.showWarning });

METHOD 2: this.modal.confirm() .size('sm') .isBlocking(true) .showClose(true) .keyboard(27) .title('Are you sure?') .body('Are you sure you want to delete "User" from that file?') .open().then(this.showSuccess, this.showWarning);

  • What is the expected behavior? to be able to handle callback from the confirm or any other modal dialog (e.g. can I delete something or request additional input before proceeding). I guess I'm just missing an example here?

  • Please tell us about your environment:

  • Angular version: 4.1.2
  • Browser: [all]

d4e666 avatar May 15 '17 20:05 d4e666

+1

devinvail avatar Jun 04 '17 14:06 devinvail

I use following code it can call the function when I click Ok or Cancel button

.open()
            .then((dialog: DialogRef<TwoButtonPreset>) => {
                dialog.result.then(result => {
                   function here
                }).catch(() => {
                   function here
                })
            }
            );

qwe852147 avatar Jun 05 '17 01:06 qwe852147

@qwe852147 is right, this information has should be explicit on documentation. :/

igoreliasm avatar Jul 31 '17 19:07 igoreliasm

You guys are correct. Thank you guys are good ones to help the documents!

nch3ng avatar Mar 18 '18 16:03 nch3ng