1
<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. Topics 是一个主题数组,一个主题看起来像这样,

{
    id: "12967",
    name: "ABCD",
    description: "ABCD"
}
4

1 回答 1

1

uib-typehead遵循与 Angular 相同的语法ng-options。所以只需改变你的uib-typehead

uib-typeahead="topic as topic.name for topic in topics|filter:$viewValue"

请看Plunker

于 2016-07-26T09:45:33.063 回答