Trying to check the checkbox using [checked] = "true" but it is not working here is a link https://stackblitz.com/edit/angular-ivy-6qeay9?file=src/app/app.component.ts
Trying to check the checkbox using [checked] = "true" but it is not working here is a link https://stackblitz.com/edit/angular-ivy-6qeay9?file=src/app/app.component.ts
As you can see by the following example
<input type="checkbox" [checked]="true"> List A
<input type="checkbox" [(ngModel)]="theCheckbox" [checked]="true"> List B
The NgModel directive is higher priority from the checked property.
So you may want to exclude checked and use NgModel to do what you are trying to do.
When the property is enclosed in brackets [], the RHS is assumed to be a property in the controller (*.ts file). See property binding for more info.
In your case you must simply do
checked=true
I just saw the Stackblitz.
<input>, it must only be checked, not checked=true.ngModel two-way binding. So you need to removed checked and set the status through the bound property theCheckbox.Controller (*.ts)
export class AppComponent {
theCheckbox = true;
}
I've modified your Stackblitz