Here's my code:
<tbody *ngFor="let user of users">
<td>{{user.name}}:</td>
<td>
<ng-select [items]="userList" bindValue="id" formControlName='id' bindLabel="label">
<ng-template ng-option-tmp let-item="item">
<div [ngbTooltip]="item.label" placement="bottom">{{item.label}}</div>
</ng-template>
</ng-select>
</td>
</tbody>
userList: [
{ id: 1, label: 1 },
{ id: 2, label: 2 }
]
users: [
{ id: 5545, name: 'Z', value: 1 }
{ id: 1112, name: 'A', value: 2 },
{ id: 4455, name: 'B', value: 1 }
]
If userList.id == user.value then it's label should be selected in drop down.
Current Result:
Expected Result:
Found the solution.
formControlName='{{user.value}}' Instead of formControlName='id' works for me.