【问题标题】:Issues with typeahead in angular角度提前输入的问题
【发布时间】:2015-04-27 18:36:30
【问题描述】:

我正在使用带有 angular js 的 typeahead 并且一切正常,期待一个案例。

假设我搜索了一些东西,比如说test,它显示了两个测试结果,但我没有点击结果,而是点击了我正在输入的文本框或屏幕上的其他任何地方,然后再次输入搜索内容然后搜索不起作用,请求被发送到后端,我得到了响应,但该响应没有在前端显示为搜索结果。

我的代码:

 <input type="text" class="form-control " name="search_title" ng-model="formData.search_title" required autocomplete="off" typeahead="state as state.name for state in searchStates($viewValue) | orderBy:name"  typeahead-loading="loading" typeahead-min-length="2" typeahead-wait-ms="100" typeahead-on-select='searchSelect($item, $model, $label)'>


$scope.searchStates = function(state){
          return $http({
            method : 'GET',
            url : '/search-state/?q='+state,
            headers: {'Content-Type': 'application/x-www-form-urlencoded'},

            }).then(function(response,status){
                return response.data;
                });

        }

【问题讨论】:

    标签: angularjs typeahead


    【解决方案1】:

    当我更改 ui-bootstrap-tpls 的版本时,我的问题得到了解决。早些时候我使用的是 0.12.1 版本,但是当我将其更改为 ui-bootstrap-tpls-0.6.0.js 时,一切正常。所以这个问题可能是由于版本错误。

    使用这个

      <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script>
    

    而不是

    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js"></script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-03
      • 1970-01-01
      • 2015-09-01
      • 1970-01-01
      • 2021-04-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多