themyth92 / ngx-lightbox

Lightbox2 use with angular >= 5
MIT License
115 stars 70 forks source link

Problems ngModal + ngx-lightbox #14

Open panterozo opened 5 years ago

panterozo commented 5 years ago

When I open the lightbox in Angular 5, everything is ok, but, when I close it and open a new dialog with ngModal, the lightbox appears again plus the new lightbox from ngModal. Why is that?

import {NgbModal, ModalDismissReasons} from '@ng-bootstrap/ng-bootstrap';

The button save:

<button type="button" class="btn btn-info" (click)="openDialog()">Save</button>

The dialog that appears:

<ng-template #content let-c="close" let-d="dismiss">
  <div class="modal-header">
    <h4 class="modal-title" id="modal-basic-title">Update</h4>
    <button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>
  <div class="modal-body">
    <p>{{mensajeModal}}</p>
    <p *ngIf="mensajeModalError"><b>Error: </b><i><span style="color:red">{{mensajeModalError}}</span></i></p>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-success" (click)="c('Save click')">OK</button>
  </div>
</ng-template>

And the opening method:

this.modalService.open(content, {ariaLabelledBy: 'modal-basic-title'}).result.then((result) => {
      this.closeResult = `Closed with: ${result}`;
    }, (reason) => {
      this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
    });

So, in summary, when I open de ngx-lightbox dialog and then open some new dialog with NgbModal, the ngx-lightbox appears again, with the last pictures seen, and breaks the normal flow.

Please, help me with this. I already took some many hours to see what is happening without positive results

Thanks in advance

themyth92 commented 5 years ago

Hmm interesting, I have never used it together with bootstrap. Let me take a look