I have an array of services with following structure: - addonOptions[] - hasAddons - serviceId addonOptions[] has objects with following structure - serviceId - addonName - addonId - isChecked
I loop through services and generate dynamic check boxes where serviceId's match. Now I want to check the checkboxes by default in case isChecked is true. But following is not working.
<ng-container *ngFor="let service of serviceOptions; let i = index">
<label *ngIf="service.hasAddons"><b>AddOns</b></label>
<p *ngFor="let addon of service.addonOptions" >
<ng-container *ngIf="service.serviceId == addon.serviceId">
<md-checkbox formControlName="addonName" type="checkbox" [ngModel]="addon.isChecked" [checked]="true" (change)="selectServiceAddon($event.checked,addon)"></md-checkbox>
</ng-container>
</p>
</ng-container>
Aucun commentaire:
Enregistrer un commentaire