Я хочу настроить раскрывающийся список типов, чтобы отображались «имя» и «оригинал». Источник json находится в форме
[
...
{
"_id": "56d0524c07e5a2940eb059c6",
"name": "english name",
"original": "original name",
"__v": 0
},
...
]
Как я видел в документах, я попробовал этот собственный шаблон:
<script type="text/ng-template" id="custom.html">
<a>
<span ng-bind-html="match.label.name | uibTypeaheadHighlight:query"></span>
<small ng-bind-html="match.label.original | uibTypeaheadHighlight:query"></small>
</a>
<input type="text" ng-model="$parent.model.referringCourt" typeahead-template-url="custom.html" uib-typeahead="item.name as item for item in search($viewValue)">
It doesn't work. The current result I get is on selection I see a single string in model, not the whole object selected. What's the proper way to:
используйте пользовательский шаблон с 2 (или 3) значениями
определить, какой из них должен отображаться в поле ввода
- сохранить весь объект как модель