It would be awesome if we could pass some custom content to the ModalComponent in the following way: modalService.show(ModalComponent, customContent) method.
I second
I have found a workaround as follows:
var modalRef = this.bsModalService.show(ModalComponent);
var modalComponent = modalRef.content as ModalComponent;
modalComponent.title = "Title";
modalComponent.updateView();
In your component inject private cd: ChangeDetectorRef and add the updateView method:
updateView() {
this.cd.detectChanges();
}
But it would be nicer that the show method BsModalService provided a way to pass data directly.
A discussion at ng-bootstrap about this has already taken place:
https://github.com/ng-bootstrap/ng-bootstrap/issues/861
Most helpful comment
I have found a workaround as follows:
In your component inject private cd: ChangeDetectorRef and add the updateView method:
But it would be nicer that the show method BsModalService provided a way to pass data directly.
A discussion at ng-bootstrap about this has already taken place:
https://github.com/ng-bootstrap/ng-bootstrap/issues/861