angular bootstrap typeahead bug

Posted by Mohammad Akbari on Stack Overflow See other posts from Stack Overflow or by Mohammad Akbari
Published on 2013-06-25T03:51:23Z Indexed on 2013/06/25 4:21 UTC
Read the original article Hit count: 242

Filed under:

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.

© Stack Overflow or respective owner

Related posts about angularjs