I am using ngb modal to my project. Currently modal is loading correctly. I need to pass data inside the modal. This is my function
loadCheckingView(viewData, checkinview) {
console.log(viewData); // this log shows my data
this.modalService.open(checkinview, { ariaLabelledBy: 'modal-basic-title', size: 'lg', backdrop: 'static' }).result.then((viewData) => {
console.log(viewData); // this log not working
}, (reason) => {
});
}
how I pass the data inside the modal
CodePudding user response:
using componentInstance it worked, try Below way i hope it worked.
loadCheckingView(viewData, checkinview) {
const modalRef = this.modalService.open(modelComponent);
modalRef.componentInstance.viewData = viewData;
}
modelComponent.ts file
@Input() public viewData;
ngOnint(){
console.log(this.viewData);
}