In this section, I am creating dynamic buttons that send values to an ng bootstrap modal. Currently, I am able to send and retrieve only one value. How can I modify the code to send multiple values and display them in the input field within the modal? Below is the sample code snippet:
Note: Although I am sending both name and id, only the ID is being displayed in the modal.
HTML File
<ng-container *ngFor="let info of Data">
<div *ngIf="info.State==='1'" >
<button [id]="info.Id" class="btn btn-outline-secondary" (click)=onOne(info.Id,info.Name)>
{{info.Name}}
</button>
</div>
</ng-container>
Below is my TypeScript code
onOne(content,data) {
this.modalService.open(content,data).result.then((result) => {
debugger;
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
private getDismissReason(reason: any): string {
if (reason === ModalDismissReasons.ESC) {
return 'by pressing ESC';
} else if (reason === ModalDismissReasons.BACKDROP_CLICK) {
return 'by clicking on a backdrop';
} else {
return `with: ${reason}`;
}
}