ng-select doesn't display value in ngModel

Viewed 106
<ng-select [items]="items$ | async"
            bindLabel="value"
            minTermLength="2"
            bindValue="id"
            [(ngModel)]="val"
            [typeahead]="valInput$">
</ng-select>

ng-select above does server-side search and until typing something that items is empty but the variable val is not. Need to see val's value as selected item but can't achieve that so my guess is the reason for that is items being empty.

Is there a way to display val in that ng-select component even if items is empty?

UPDATE: I've populated items$ with existing values. But still can't make them selected.

UPDATE 2: I've found the solution, bindValue="id" was the problem and I needed to remove it which means binding the whole object instead of it's id attribute to selected item.

0 Answers
Related