I am reading the offical Primeng docs below:
http://primefaces.org/primeng/inputswitch
I can see how to make p-inputSwitch
preselected by default with [(ngModel)]
.
My question is how I can do the same thing under form? I understand I cannot use both [(ngModel)]
and formControlName
at the same time.
Can anyone please give me a simple example?
Thank you
It's in the Stackblitz of the official example you link to. Set the bound property to true
.
export class AppComponent {
checked2: boolean = true;
}
<h5>Preselection</h5>
<p-inputSwitch [(ngModel)]="checked2"></p-inputSwitch>