stop closing the modal by clicking backdrop or outside the modal

Discussão em 'Angular' iniciado por Partha Sarathi Ghosh, Março 23, 2025.

  1. I have used one angular2 ng-bootstrap modal in our code.

    I want the modal will not close when I click outside the modal. Currently, the modal is getting closed while clicking outside.

    In Angular1 I used to do this by:

    [keyboard]="false"
    [backdrop]="'static'"


    But this time it is not working in Angular2.

    Here is my plunker

    My Open method is as follows:

    open() {
    const modalRef = this.modalService.open(NgbdModalContent);
    modalRef.componentInstance.name = 'World';
    }

    Continue reading...

Compartilhe esta Página