mardi 20 septembre 2022

Mat-checkbox change event is not triggering function

I have this mat select with checkboxes. Inside, once I press the first checkbox I want the function timeSlotChecked() to be called, but it is not. What am I doing wrong?

<mat-select class="mat-select-height stop-settings" placeholder="Settings" name="orderStop">
  <mat-checkbox [disabled]="isStopViewMode(stop) || disableSettings" class="mat-checbox-alignment" [(ngModel)]="order.orderStops[index].isTimeSlotRequired" [checked]="order.orderStops[index].isTimeSlotRequired" (change)="timeSlotChecked(order.orderStops[index])" name="isTimeSlot">Time slot required</mat-checkbox><br>
  <mat-checkbox [disabled]="isStopViewMode(stop) || disableSettings" class="mat-checbox-alignment" [(ngModel)]="order.orderStops[index].isOnSiteStop" name="isOnSiteStop">On site stop</mat-checkbox><br>
  <mat-checkbox [disabled]="isStopViewMode(stop) || disableSettings" class="mat-checbox-alignment" [(ngModel)]="order.orderStops[index].autoGenerateFeedback" name="isAutoGenerated">Auto-generate feedback</mat-checkbox><br>
  <mat-checkbox [disabled]="isStopViewMode(stop) || disableSettings" class="mat-checbox-alignment" [(ngModel)]="order.orderStops[index].isNeutral" name="isNeutral">Is neutral</mat-checkbox><br>
  <mat-checkbox [disabled]="isStopViewMode(stop) || disableSettings" class="mat-checbox-alignment" [(ngModel)]="order.orderStops[index].isApproximationDate" name="isApproximationDate">Is approximation date</mat-checkbox><br>
  <mat-checkbox [disabled]="isStopViewMode(stop) || disableSettings" class="mat-checbox-alignment" [(ngModel)]="order.orderStops[index].isFridayLoadUnloadSurcharge" name="isFridayLoadUnloadSurcharge">Friday (un)load surcharge</mat-checkbox><br>
  <mat-checkbox [disabled]="isStopViewMode(stop) || disableSettings" class="mat-checbox-alignment" [(ngModel)]="order.orderStops[index].isMondayLoadUnloadSurcharge" name="isMondayLoadUnloadSurcharge">Monday (un)load surcharge</mat-checkbox>
</mat-select>``


public timeSlotChecked(stop: OrderStop) {
  if (stop.isTimeSlotRequired) {
    this.timeSlotChanged(stop);
  }
}



Aucun commentaire:

Enregistrer un commentaire