【发布时间】:2016-03-01 16:24:55
【问题描述】:
var app = angular.module('plunker', ['ui.bootstrap']);
app.controller('MainCtrl', function($scope) {
$scope.FDLAccountOther = [{
"fdlAccountId": 300,
"fdlAccountName": "IS00698000",
"fdlAccountDesc": "PT Rebates -To Trading Desks on selling concessions paid to IFG",
"fdlAccountType": "R",
"setId": "FDL01",
"isDefault": null,
"balanceForward": null,
"bsIndicator": null,
"status": "Active"
}, {
"fdlAccountId": 301,
"fdlAccountName": "IS00699000",
"fdlAccountDesc": "PT Rebates -To Trading Desks on selling concessions paid to IIG",
"fdlAccountType": "R",
"setId": "FDL01",
"isDefault": null,
"balanceForward": null,
"bsIndicator": null,
"status": "Active"
}]
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.2.1/ui-bootstrap-tpls.js"></script>
<!DOCTYPE html>
<html ng-app="plunker">
<div class="input-group" ng-controller="MainCtrl">
<input type="text"
class="form-control"
ng-model="formData_TransGrid.fdlAcctNameOther"
placeholder="Enter FDL Account"
uib-typeahead="item.fdlAccountName as item.fdlAccountName for item in FDLAccountOther | filter:$viewValue|limitTo:3" />
<span class="input-group-btn">
<button class="btn btn-success ebtn"
type="button"
data-toggle="modal"
data-target="#FDLAccountLookUp">
Find FDL
</button>
</span>
</div>
</html>
实际上还有很多记录,但是预先输入的建议似乎不起作用,有什么帮助吗?
更新
在 typeahead 指令前添加 uib 解决了这个问题。感谢您的帮助
更新
在 typeahead 指令前添加 uib 解决了这个问题。感谢您的帮助
【问题讨论】:
-
当前sn-p中的typeahead工作,这就是你需要的,你的代码没有错。也许您忘记在模块创建中添加对“ui.bootstrap”的引用。我已将
typeahead更改为uib-typeahead,这本来可以解决问题的。 -
是的,添加 uib 似乎已经成功了。谢谢
标签: javascript angularjs twitter-bootstrap twitter-bootstrap-3 bootstrap-typeahead