lundi 13 janvier 2020

Can we use a method on [checked] property of checkbox to set it to true/false

I want to set the [checked] property of the checkbox on a method call, but when I do that, the method is called but it doesn't change the status of the checkbox

HTML

<div*ngFor="let vest_style of VEST_STYLE">
    <input type="checkbox" value="" (change)="onCheckboxChange($event,i)" 
    [checked]="isCheckedFromOrder(vest_style._id)">&nbsp;
</div>

TS

isCheckedFromOrder(id) {
    this.styles.value.forEach(style => {
      console.log(style === id)
      return style === id
    })
  }



Aucun commentaire:

Enregistrer un commentaire