【发布时间】:2013-07-19 08:37:14
【问题描述】:
使用 typeahead,我正在尝试设置几个选项,它们可作为标准 Bootstrap typeahead options
使用下面的代码,我可以将“minLength”属性设置为“typeahead-min-length”,但将“items”设置为“typeahead-items”则不会.有没有不同/更好/标准的方法来做到这一点?有没有办法将一组选项附加到 $scope?
<div class='container-fluid' ng-controller="TestController">
<input type="text" ng-model="selected"
typeahead="foo for foo in foo | filter:$viewValue" typeahead-items='5' typeahead-min-length='3'>
<pre>{{selected| json}}</pre> </div>
更新:我正在尝试只使用 AngularJS,而不是使用 jQuery
这是我的控制器:
myAppModule.controller('TestController', function($http,$scope) {
$scope.selected = undefined;
$http.get('data/sample.json')
.then(function(results){
$scope.foo = results.data;
});
});
【问题讨论】:
标签: angularjs typeahead angular-ui-bootstrap