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?
<mat-checkbox class = "example-margin" [(ngModel)] = obj.impresora>
<label>Printer</label>
</mat-checkbox>
obj.impresora property is boolean
Make sure you have this code on you component:
For check it with ngModel, make a merge between "ngModel" and "value", Example:
Where, myVariable = 1
Greeting
Set this in HTML:
Changes in Ts file
Conditionvalidation in Ur Business logic
You need to make sure the
checked
property to be true inside the component.tsthis works for me in Angular 7
I hope help someone ... greetings. let me know if someone have some easiest