我在我的应用程序中使用 angular bootstrap typeahead (this lib ui-bootstrap-tpls.js),当在一个范围内使用两个 typeahead 时,只有一个可以正常工作,而其他不工作,这是我的代码
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>
请检查并帮助。