I have an angular project in which I am using a PrimeNG checkbox component but there is an issue when I am trying to set the checkbox's default value to checked. I even tried binding [checked] property but I guess it is not known to p-checkbox.
HTML file
<p-checkbox name="checkboxName" [(ngModel)]="checked"
binary="true" label="Perform Notifications"></p-checkbox>
{{checked}}
Component file
export class XYZ{
checked: boolean = true;
}
When that gets loaded, I can see value of checked variable as 'true' below in HTML page but the checkbox is blank or unchecked.
Try this. It works for me.
In .ts file:
In .html file: