0

I have this checkbox when user.IsActive is 0 still the checkbox is checked

<input type="checkbox"  [(ngModel)]="user.IsActive" (change)="user.IsActive = $event.target.checked ? 1: 0" [checked]="user.IsActive == 1 || user.IsActive=='1' ? true : false">

i have used this condition [checked]="user.IsActive == 1 || user.IsActive=='1' ? true : false"

but it's not working.

Any solution Thanks

1
  • 2
    Can you try removing the [(ngModel)] binding as you already bind by (change) and [checked]? Commented Nov 25, 2022 at 12:48

1 Answer 1

1

Jay Swaminarayan Try this

<input type="checkbox" (change)="user.IsActive = !user.IsActive" [checked]="user.IsActive">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.