ngbTypeahead use only id field for ngModel instead of whole object

Viewed 748

How can I tell ngbTypeahead to put only the id of the selected object in the ngModel and retrieve the current value from the id of the current ngModel.

e.g I have Countries in the form of {id: 1, name: USA} I want to display "USA" but only want 1 in my ngModel.

I use result and inputFormatter for displaying "USA" but I always get the whole object in my ngModel instead of the id.

0 Answers
Related