arhan892014-10-21 08:19:11
arhan89, 2014-10-21 08:19:11

Angularstrap Typeahead value selection for ng-model, how after value selection to show property of selected object?

I use Angularstrap in the project and its Typeahead component to select a value for ng-model, how to show the property of the selected object after selecting the value, then after selecting the application gets what you need,

[{"item":{"id":"125","name":"(3217) Горка «Веселый малыш»","cost":"16061"},"count":1}]

at the same time, the input itself displays (3217) Gorka “Cheerful kid before any change in the model,
and after the manipulations it is empty (as I understand it, this is due to the fact that he is trying to display the item{} object itself,
because ng-model="product .item".
How can I make this plugin select product.item but display product.item.name ?
<input type="text"
   placeholder="Введите артикул или наименование продукта"
   ng-options="item as item.name for item in catalog "  ng-keyup="changeProduct($index, product)"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
arhan89, 2014-10-22

So far I had to solve the problem with a crutch.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question