【问题标题】:typeahead no results no console errortypeahead no results 没有控制台错误
【发布时间】:2015-10-23 21:59:09
【问题描述】:

bootstrap-ui typeahead 没有显示结果。

控制器

    .controller('FakturaAddCtrl', function ($rootScope, $scope, $timeout) {
        $scope.selected = undefined;
        $scope.states = ['Alabama', 'Wyoming'];
});

查看

                            <div class="form-group">
                            <label><i class="fa fa-globe"></i> State</label>
                            <input type="text" ng-model="selected" uib-typeahead="state for state in states | filter:$viewValue | limitTo:8" class="form-control">
                        </div>

https://angular-ui.github.io/bootstrap/ 上的示例

当我运行时,我只是得到了输入字段,但没有下拉数据(typeahead 功能不运行?)

也没有控制台错误

【问题讨论】:

  • 确保您还包括用于预先输入的模板。
  • @dfsq 包含在“ui-bootstrap-tpls.min.js”中?
  • 应该是uib-typeahead 而不是bs

标签: angularjs twitter-bootstrap angular-ui-bootstrap typeahead.js


【解决方案1】:

您指的是 ui-bootstrap,但使用的是另一个模块 angularStrap 中的指令。

替换:

bs-options="state for state in states"  bs-typeahead

与:

ui-bootstrap >= 0.14:

uib-typeahead="state for state in states | filter: $viewValue"

ui-bootstrap

typeahead="state for state in states | filter: $viewValue"

【讨论】:

  • 更改为 ' ' 但仍然没有结果,也没有控制台错误
  • 你是否在模块依赖数组中添加了ui.bootstrap
  • 他们在 0.14 中进行了名称更改。如果您使用的是该版本,请删除指令名称中的 uib- 前缀。或者升级到 0.14+。
  • 是的,升级 ui.bootstrap 和 angular 完成了这项工作! :D
  • 如果你愿意,可以添加这个答案
【解决方案2】:

这个对我有用 ---

typeahead="state for state in states | filter: $viewValue"

【讨论】:

    【解决方案3】:

    首先需要检查模块,是否添加了ui.bootstrap

    var app = angular.module('myApp', [...., 'ui.bootstrap']);
    

    对我来说,我错过了,浪费了我的 2 个小时。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-06
      • 1970-01-01
      • 2013-05-21
      • 2014-07-18
      • 2013-05-22
      • 2021-11-17
      相关资源
      最近更新 更多