Issue
      <label class="switch">
        <input type="checkbox" id="balanced" [(ngModel)]="balancedAmount" (click)="onNoClick($event)">
        <span class="slider round"></span>
      </label>
how can I programmatically set the checkbox to true or false?
TypeScript
  this.balancedAmount.checked = false;
Solution
You can create a variable and toggle true or false and you can property bind that value to the [checked] property
 <label class="switch">
        <input type="checkbox" id="balanced" [(ngModel)]="balancedAmount" (click)="onNoClick($event)" [checked]="this.balancedAmount.checked">
        <span class="slider round"></span>
      </label>
this.balancedAmount.checked= true;
Answered By - Abhishek Upadhyay
 
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.