mercredi 9 octobre 2019

How to make the checkbox not change value

I have a checkbox that when i click, execute a function on angular with a validations for know if i must change the value. The problem is that although i set the variable to false, the checkbox is set to true.

Code in HTML:

<input id="check" type="checkbox" [checked]="test" [(ngModel)]="test" (click)="testClick(test)">

Code in component.ts:

public test = false;

public testClick(value) {
  value = false;
}

this.test = false in the function doesn't work.

PD: in this code don't have the validations, only i set the value to false for test.

EDIT: What i want is that if i set the value to false that the checkbox does not show up with the check




Aucun commentaire:

Enregistrer un commentaire