2017-09-15 19 views
1

작동하지 않습니다이 내 코드입니다. 그러나 this.modalService.open(modal)이 완벽하게 작동하는 동일한 기능에서 작동하지 않습니다. 여기에서 잘못 됐는지 this.modalService.close is not a function각도 (2/4) modalService.close는()

어떤 제안 :

는이 오류는 무엇입니까?

+1

modalService.close를 (닫을 수 있습니다) – Chandru

답변

1

당신이 약속을 오픈 모델의 참조를 얻고 그것을 닫을 수 있습니다. `오류 : 이제

editDocumentRow = function(documentId, modal) { 
    this.http.get(ConstantComponent.url + '/documentmanagerapi/Get/' + documentId).map((res: Response) => res.json()).subscribe(data => { 
     this.documentsRowDetails = data 
     this.modalService.open(modal) 
     this.modalReference = this.modalService.open(modal); 
     this.modalReference.result.then((result) => { 
      this.closeResult = `Closed with: ${result}`; 
     }, (reason) => { 
      this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; 
     }); 


    }) 
} 

당신이 this.activeModal.dismiss을 (대신 작업을 사용하지 않습니다) 모델

this.modalReference.close(); 
1

열기 모달 :

constructor(
    private modalService: NgbModal 
) { } 

this.modalService.open() 

닫기 활성화 모달 :

constructor(
    public activeModal: NgbActiveModal 
) { } 

editDocumentRow = function (documentId, modal) { 
    this.activeModal.dismiss(); 
}) 
+0

나는이 오류가 발생하지 오전 NgbActiveModal에 대한 바이더를 ! ' –

+0

'@ ng-bootstrap/ng-bootstrap '에서'import {NgbModal, NgbActiveModal}'을 추가했지만 도움이되지 않습니다. 제발 제안하십시오 –

+0

나는 또한이 오류가 발생 :'오류 : 이미 활성화 된 콘센트를 활성화 할 수 없습니다' –