<ng-container *ngFor="let item of collectionValues">
<ion-checkbox slot="end" (ionChange)="onCheckBoxChange(item, $event)"
[(ngModel)]="item.value">
</ion-checkbox>
</ng-container>
This is ok but the problem is that if a value is assigned to item.value from the code in .ts i.e. then the onCheckBoxChange() is called which I don't want to. I have tried using the (click) event but that is not what I want.
how do I prevent it from going to onCheckBoxChange event if a value is assigned. It should only go to the event if checked from UI.
As mentioned in the Angular Documentation you can use ngModelChange for your scenario
Event emitter for producing the ngModelChange event after the view model updates.
<ng-container *ngFor="let item of collectionValues">
<ion-checkbox slot="end" (ngModelChange)="onCheckBoxChange(item, $event)"
[(ngModel)]="item.value">
</ion-checkbox>
</ng-container>