Reputation: 123
bootstrap-ui typeahead shows no results.
controller
.controller('FakturaAddCtrl', function ($rootScope, $scope, $timeout) {
$scope.selected = undefined;
$scope.states = ['Alabama', 'Wyoming'];
});
view
<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>
used example on https://angular-ui.github.io/bootstrap/
when i run i just got the input field, but no drop down data (typeahead function dosen't run?)
also got no console errors
Upvotes: 2
Views: 1803
Reputation: 22723
First thing you need to check the module, whether you added ui.bootstrap
or not
var app = angular.module('myApp', [...., 'ui.bootstrap']);
For me, I missed it and waste my 2 hours.
Upvotes: 1
Reputation: 11
This one worked for me ---
typeahead="state for state in states | filter: $viewValue"
Upvotes: 1
Reputation: 28259
You are referring to ui-bootstrap but using the directive from angularStrap, which is another module.
Replace:
bs-options="state for state in states" bs-typeahead
with:
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"
Upvotes: 2