shlomiassaf / ngx-modialog

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

[question] Should the modal dismiss automatically when clicking outside of it ? #250

Closed lordpiti closed 7 years ago

lordpiti commented 7 years ago

Just tried to click outside of the modal after opening it but it doesn't close this way. It does when pressing ESC key though.

I create the modal this way : this.modal.open(CreateEditPressModal, overlayConfigFactory({ pressItem: pressItem, mediaOutletBlogTypes: this.MediaOutletBlogTypes }, BSModalContext));

Is this the normal behaviour and if so, how can i set up the modal so that it closes when clicking outside of it ?

animator013 commented 7 years ago

OverlayContext class has isBlocking field. Maybe setting it to false like this could help:

this.modal.open(CreateEditPressModal, overlayConfigFactory({ isBlocking: false, pressItem: pressItem, mediaOutletBlogTypes: this.MediaOutletBlogTypes }, BSModalContext));

lordpiti commented 7 years ago

Thanks animator013 that was it!

conqsys commented 7 years ago

openPurchaseModal() { const builder = new BSModalContextBuilder( { num1: 2, num2: 3 } as any, undefined, InvoiceEntryPurchaseModalContext );

let overlayConfig: OverlayConfig = {
  context: builder.toJSON()
};

const dialog = this.modal.open(InvoiceEntryPurchaseComponent, overlayConfig({isBlocking: false}));
dialog.then((resultPromise) => {
  return resultPromise.result.then((result) => {
    // alert(result.status);
    if (result != null) {
      this.GetSelectedPurchaseOrder(result);
    }
  }, () => console.log(' Error In Purchase modal '));
});

}

const dialog = this.modal.open(InvoiceEntryPurchaseComponent, overlayConfig({isBlocking: false}));

I'm using like that getting error [ts] Cannot invoke an expression whose type lacks a call signature. (property) isBlocking: boolean