I am trying to use an Angular Material checkbox, and set it by default as checked, but it is displayed as non-checked, what is wrong?
// in component.ts
checked: boolean = true;
indeterminate:boolean = false;
disabled:boolean = false;
label:string;
onCheck() {
this.label = this.checked?'ON':'OFF';
}
// in component.html`enter code here`
{{label}}
The above code should work fine. Mat checkbox allows you to make it checked/unchecked, disabled, set indeterminate state, do some operation onChange of the state etc. Refer API for more details.