Thomas Blauenfeldt Thomas Blauenfeldt - 6 months ago 69
AngularJS Question

typeahead no results no console error

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

Answer

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"