I’m trying to update my checkbox value in ionic 3. But i don’t know how to set value as checked based on server response value.
<ion-item *ngFor="let m of mediumType">
<ion-label>{{m.name}}</ion-label>
<ion-checkbox formControlName="medium" (ionChange)="checkMediumValue(m,$event)"></ion-checkbox>
</ion-item>
checkMediumValue(item:any,event){
let index;
if (event.checked === true) {
this.selectedMid.push(item.id);
}
else
{
index = this.selectedMid.indexOf(item.id);
this.selectedMid.splice(index, 1);
}
}
this.ionicForm.controls['medium'].setValue(result.data.medium);