gpt4 book ai didi

angularjs - Angular UI typeahead 不显示下拉菜单

转载 作者:行者123 更新时间:2023-12-02 12:38:03 26 4
gpt4 key购买 nike

我正在尝试使用 Angular UI typeahead。我的问题是下拉菜单没有显示。远程数据正在正确调用并且数据正在返回...但下拉列表拒绝显示...

<td colspan="5">
<pre>Model: {{selected| json}}</pre>
<input id="AutoCompleteDebtor"
type="text"
data-ng-model="selected"
data-typeahead="debtor for debtor in Debtors($viewValue)"
class="form-control input-sm"
placeholder="Enter 3 letters of Debtor Name" />
</td>

更新:好的 - 它可以很好地处理字符串名称数组,但如何处理对象?

<!DOCTYPE html>
<html data-ng-app="myApp">
<head>
<title>Angular Typeahead</title>
<link href="Content/bootstrap/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/angular.min.js"></script>
<script src="Scripts/ui-bootstrap-tpls-0.6.0.min.js"></script>
<script>
angular.module('myApp', ['ui.bootstrap'])
.controller('SimpleController', function ($scope) {
$scope.people = [
{ name: 'Alan', age: 23 },
{ name: 'Bruce', age: 24 },
{ name: 'Celine', age: 53 },
{ name: 'Dan', age: 43 },
{ name: 'Eric', age: 23 },
{ name: 'Freda', age: 47 },
{ name: 'Greg', age: 73 },
{ name: 'Hanna', age: 27 }
];
});
</script>

</head>
<body data-ng-controller="SimpleController">
<div>
<pre>Model: {{selected| json}}</pre>
<input type="text" data-ng-model="selected" data-typeahead="name for name in people | filter:$viewValue | limitTo:8">
</div>
</body>
</html>

我一直关注https://github.com/angular-ui/bootstrap/tree/master/src/typeahead示例

最佳答案

我在这个 fiddle 上找到了答案:http://jsfiddle.net/ukAc5/1/

data-typeahead="n.name for n in people

关于angularjs - Angular UI typeahead 不显示下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19321164/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com