Mohammad Akbari
Mohammad Akbari

Reputation: 4766

angular bootstrap typeahead bug

i use angular bootstrap typeahead (this lib ui-bootstrap-tpls.js ) in my app, when use two typeahead in one scope, only one work well, and other not work, this is my code

angular.module('plunker', ['ui.bootstrap']);
function TypeaheadCtrl($scope) {

    $scope.selected = undefined;
    $scope.selected2 = undefined;

    $scope.states = ['Alabama', 'Alaska','California', 'Hawaii',  'Wisconsin', 'Wyoming'];
}

<html ng-app="plunker">
    <head>
    <title></title>
    <link href="lib/angular-bootstrap/bootstrap.css" rel="stylesheet" />
    <script src="lib/angular/angular.js"></script>
    <script src="lib/angular-bootstrap/ui-bootstrap-tpls-0.3.0.min.js"></script>
    <script src="app.js"></script>
    </head>
    <body>
        <div class='container-fluid' ng-controller="TypeaheadCtrl">
        <pre>Model: {{selected| json}}</pre>
        <input type="text" ng-model="selected" typeahead="state for state in states | filter:$viewValue">
        <input type="text" ng-model="selected2" typeahead="state for state in states | filter:$viewValue">
        </div>
   </body>

please check this and help.

Upvotes: 0

Views: 1933

Answers (1)

pkozlowski.opensource
pkozlowski.opensource

Reputation: 117370

It was cross-posted as the issue on GitHub as well: https://github.com/angular-ui/bootstrap/issues/562

It is not a bug in the typeahead code, it simply requires AngularJS version >= 1.0.4

Here is a working plunk with cleaned-up dependencies: http://plnkr.co/edit/00xjmfCR5A3Gb7VMC3Ta?p=preview

Upvotes: 1

Related Questions