先行入力を使用して、標準の Bootstrap先行入力オプションとして利用できるいくつかのオプションを設定しようとしています。
次のコードを使用すると、「typeahead-min-length」としてインラインで「minLength」プロパティを設定できますが、「typeahead-items」と同じように「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>
更新: jQuery を使用せず、AngularJS のみを使用しようとしています。
これは私のコントローラーです:
myAppModule.controller('TestController', function($http,$scope) {
$scope.selected = undefined;
$http.get('data/sample.json')
.then(function(results){
$scope.foo = results.data;
});
});