<input type="text"
class="topic_select"
id="selectTopic"
ng-model="topicsPopulate"
uib-typeahead="topic.name for topic in topics|filter:$viewValue"
uib-typeahead-show-hint="true"
uib-typeahead-min-length="1"
typeahead-on-select="TopicChanged(topicsPopulate)" />
我实际上想要发送我选择的主题(带有许多变量的json对象),而不是topicsPopulate
中存储的字符串(主题名称)。
主题是一个主题数组,主题如下:
{
id: "12967",
name: "ABCD",
description: "ABCD"
}
答案 0 :(得分:1)
uib-typehead
遵循与Angular ng-options
相同的语法。所以只需改变你的uib-typehead
:
uib-typeahead="topic as topic.name for topic in topics|filter:$viewValue"
请查看Plunker。