lundi 29 mars 2021

How to get the value of each checkbox inside foreach in angular 9 reactive forms

I have a checkbox in each row of primeng ptable and also a click function in each checkbox. The code is given below :

<ng-template let-productList>
  <input type="checkbox" (change)="updateStatus(productList.product_id, $event)">
</ng-template>

In component.ts :

updateStatus(productid: any, e: any) {
      console.log(productid)
  }

When I click any checkbox am getting only the first productid in updateStatus function. how can I solve this issue in reactive form?




Aucun commentaire:

Enregistrer un commentaire