oferh / ng2-completer

Angular 2 autocomplete component
http://oferh.github.io/ng2-completer/
MIT License
347 stars 172 forks source link

NgModel doesn't care about titleFields #455

Open QBIRGAENTZLE opened 4 years ago

QBIRGAENTZLE commented 4 years ago

I use ng2-completer with an array of objects with many properties, so I used completerService titleFields parameter to display it properly.

I want to use the 1st element of my array as default value, so I used ngModel.

But, the value isn't displayed correctly, my object is stringify and display as a string, the titleFields parameter of the completerService is apparently ignored with ngModel.

Stackblitz with the problem

I know I could do [(ngModel)]="searchStr.color" instead of [(ngModel)]="searchStr" but I have more complicated cases where I would appreciate NgModel works properly with titleFields parameter

Any way to make it works properly ?

Thank you