utiliser les données passees a un modal dans son propre composant en angular

JavaScript
const modalRef = this.modalService.open(ModalComponent);

modalRef.componentInstance.passedData= this.dataToPass;

modalRef.result.then(result => {
  //do something with result
}                                                       export class ModalComponent { 

 passedData: typeOfData;     //declare it!

 someFunction() {     //or some  lifecycle hook 
  console.log(this.passedData)  //and then, use it!
 }

//rest of the ModalComponent 
}
Source

Also in JavaScript: