AngularJS UI Bootstrap Typeahead 未按预期工作

AngularJS UI Bootstrap Typeahead not working as expected

我正在使用 Elasticsearch 和 AngularJS 构建一个小型搜索应用程序。我正在使用 AngularJS UI bootstrap typeahead 来实现自动完成,我正在使用 ES 的 edge_n_gramshighlight object 来 1) 生成建议和 2) 突出显示的建议,分别。 ES 高亮对象将建议包装在 HTML <em></em> 标签中... 似乎 导致我的设置方式出现一些问题。

1) 当我按下 Enter 键而不是单击搜索按钮时 - 所发生的一切是搜索词显示在 <em></em> 标签中,并且没有执行任何搜索... <em>search terms</em>

2) 当我用鼠标 select 一个建议时,同样的事情发生了。

唯一一次执行搜索是在我输入查询并单击搜索按钮时...

这是我正在使用的搜索表单,我在表单元素和按钮上有 ng-submit="search()" ,不知道我哪里出错了...... ?

<form name="q" ng-submit="search()" class="navbar-form" id="results-search" role="search">
  <div class="input-group">
    <input type="text" name="q" ng-model="searchTerms" class="form-control input-md" placeholder="{{ searchTerms }}" id="search-input" uib-typeahead="query for query in getSuggestions($viewValue)" typeahead-on-select="search($item)">

      <div class="input-group-btn">
        <button type="submit" ng-submit="search()" class="btn btn-primary btn-md"><i class="fa fa-search fa-lg"></i></button>
        </div>
   </div>
</form>

我是不是在 UI Bootstrap Typeahead 做错了什么?

更多说明 所以基本上我要问的是如何在 selection 上从建议中删除 标签并进行搜索?

Whosebug 中已经问过类似的例子:Click here