0
I have the following checkbox:
<mat-checkbox [(ngModel)]="anuncio.checkouCarimbo" (click)="checkouAnuncio()" name="checksegundoAnuncio"
class="example-margin checkFoto">
</mat-checkbox>
Function called by checkbox when clicked:
checkouAnuncio(){
for(let i=0;i<this.anuncios.length;i++){
if(this.anuncios[i].checkouCarimbo == true){
this.habilitaCarimbar = true;
return;
}else{
this.habilitaCarimbar = false;
}
}
}
My goal is to go through the advertising array and if at some position the checkouCarimbo is true, set this.enable fieldCarimbar, but when clicking is called the function and only then is set in ngModel, so my logic is broken. Is there any way to receive the value first and then perform the function or follow that order?
You should listen to the change over click event
– Eduardo Vargas