I would like to know if there is a way to identify my checkbox, along with the event that occurs when it is selected, that is, if I can put a type of ID and pass it to my .ts file, along with the true or false that responds to me the event.
<p-checkbox name="reviewed" inputId="reviewed" [(ngModel)]="data.reviewed"
[binary]="true" (onChange)="checkValue(data.reviewed)">
</p-checkbox>
checkValue(event: any){
//here I want to recerive the checkbox ID;
console.log(event);
}
you can create a template variable for the checkbox component then pass the inputId
<p-checkbox name="reviewed" inputId="reviewed" [(ngModel)]="data.reviewed"
[binary]="true" (onChange)="checkValue(checkElm.inputId ,data.reviewed)" #checkElm>
</p-checkbox>
component.ts
checkValue(id,event: any){
//here I want to recerive the checkbox ID;
}
if you want you can just pass the id as hardcoded value
<p-checkbox name="reviewed" inputId="reviewed" [(ngModel)]="data.reviewed"
[binary]="true" (onChange)="checkValue('reviewed',data.reviewed)" >
</p-checkbox>