typeahead 无结果 无控制台错误

typeahead no results no console error

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/

上使用了示例

当我 运行 我刚得到输入字段,但没有下拉数据(输入功能没有 运行?)

也没有控制台错误

您指的是 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 < 0.14 :

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

这个对我有用 ---

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

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

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

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