I have a list of objects that I want to bind to for checkboxes. The problem I'm having is that all of my checkboxes will be disabled when I only want to disable specific ones in the list. What is the proper way to setup the *ngfor and checkbox? Here I'm using the PrimeNg checkbox but if you know for a regular checkbox that would be a helpful stepping stone.
component.ts has this:
this.options = [
{ name: "A", checked: true, disabled: true },
{ name: "B", checked: false, disabled: false },
{ name: "C", checked: false, disabled: false },
];
component.html:
<div class="form-group row">
<span *ngFor="let test of options; let i=index" class="col-sm-4">
<p-checkbox binary="true" [(ngModel)]="test.checked" label=""
[ngModelOptions]="{standalone: true}" disabled=""></p-checkbox>
</span>
</div>
Aucun commentaire:
Enregistrer un commentaire