A
A
arhan892014-10-21 08:19:11
JavaScript
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"
    class="input-medium"   
    data-min-length="2" 
   placeholder="Введите артикул или наименование продукта"
   ng-options="item as item.name for item in catalog "  ng-keyup="changeProduct($index, product)"
   ng-model="product.item"
   bs-typeahead
                        />

Answer the question

In order to leave comments, you need to log in

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

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