Angular 2 ng-bootstrap close Modal

前端 未结 3 913
无人及你
无人及你 2020-12-09 17:50

I am trying to close the modal that was presented to me through the open(content) function as shown in the example in the Documentation of ng-boostrap. In the website, it me

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 18:42

    1. At your modal component you need to add the line :

      @ViewChild('exampleModal') public exampleModal:ModalDirective;
      
    2. At html modal you need to insert in the div root :

      #exampleModal="bs-modal"
      
    3. At your modal component :

      onSave(){
         this.exampleModal.hide();
      }
      

提交回复
热议问题