shlomiassaf / ngx-modialog

Modal / Dialog for Angular
http://shlomiassaf.github.io/ngx-modialog
MIT License
686 stars 241 forks source link

Still facing console error when closing modal popup by clicking on close button. #409

Open kpranjan1 opened 6 years ago

kpranjan1 commented 6 years ago

core.js:1350 ERROR Error: Uncaught (in promise): undefined at resolvePromise (zone.js:824) at resolvePromise (zone.js:795) at eval (zone.js:873) at ZoneDelegate.invokeTask (zone.js:425) at Object.onInvokeTask (core.js:4617) at ZoneDelegate.invokeTask (zone.js:424) at Zone.runTask (zone.js:192) at drainMicroTaskQueue (zone.js:602) at ZoneTask.invokeTask [as invoke] (zone.js:503) at invokeTask (zone.js:1540)

GeorgeBark commented 6 years ago

I've got the same error. It also happens when closing a confirm modal by "not confirming" (as in cancel).

ashfaqch commented 6 years ago

I don't get the error. Hope this example helps: https://github.com/ashfaqch/angular-modal-dialog-example

bhushangahire commented 5 years ago

This comes with Version 3.0.2 and I have Angular 4 if that helps.

bbrink68 commented 4 years ago

Ahh, yes - per the example I was missing the onrejected callback. Previously when I was getting error:

dialogRef.result.then((result) => {
  if (result) {
    alert(`The result is: ${result}`);
  }
});

Simple adding the onrejected callback prevents the error from occurring:

dialogRef.result.then((result) => {
  if (result) {
    alert(`The result is: ${result}`);
  }
}, () => {
  return;
});

Still though, you'd expect the library to check for the presence of a onrejected callback before attempting to call it.