I'm not an expert on Angular events but here's my issue. If I run the following code I'm bassically updating the backend with the wrong information because item.their_platform
doesn't change before togglePlatform()
fires.
Template:
<mat-checkbox (ngModelChange)="togglePlatform()" [(ngModel)]="item.their_platform"></mat-checkbox>
TS:
togglePlatform(){
//update backend with the new value for item.their_platform
}
I've solved the issue by using a timeout in the togglePlatform
method, though I'm hoping there's a different event I can tie that method to that makes more sense in this scenario.
Is there a better event? Is this a side effect of using mat-checkbox vs using vanilla Angular?
Thanks