I have this code:
<ng-container matColumnDef="pricingTemplateId">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Margin</th>
<td mat-cell *matCellDef="let customer">
{{customer.pricingTemplateName}}
</td>
</ng-container>
<ng-container matColumnDef="PricingTemplatesList">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Margin Template</th>
<td mat-cell *matCellDef="let customer">
<select id="pricingtemplates" name="ddlPricingTemplate">
<option *ngFor="let pricingTemplate of customer.pricingTemplatesList" [(ngModel)]="customer.pricingTemplateName">{{pricingTemplate.name}}</option>
</select>
</td>
</ng-container>
For the select control I'm attaching array of objects like in the screenshot below:
Now, I also have another string value in the model on which I want to base the selected value in the dropdown.
When I do [(ngModel)]="customer.pricingTemplateName" which is basically a string I'm getting this message "No value accessor for form control with unspecified name attribute"
Without the ngModel property I'm able to list all the template names in the dropdown but do I need to do some change in order to set the selected value based on a string?
