jeudi 27 décembre 2018

how to uncheck/check a primeng checkbox manually

html

          <p-checkbox name="showLinkedRisksOnly" id="showLinkedRisksOnlyChkBx" label="Show Only Linked Risks" binary="true" (click)="showOnlyLinkedRisks($event)"
                      [ngModel]="showLinkedRisksOnly" ></p-checkbox>

typescript

showOnlyLinkedRisks($event){
  if(condition){
    this.showLinkedRisksOnly = !this.showLinkedRisksOnly;
  }
}

I am trying to change the state of checkbox back to before it was checked/unchecked based on condition. But for some reason the checkbox and model get out of sync when I do change the value of this.showLinkedRisksOnly. Is it possible to achive




Aucun commentaire:

Enregistrer un commentaire