我的 JSON 中有两个字段:first_name
和last_name
.
我想使用 Bootstrap typeahead.js,使用 Angular-UI。
<script type="text/ng-template" id="customTemplate.html">
<a>
<span bind-html-unsafe="match.label | typeaheadHighlight:query"></span>
</a>
</script>
<input type="text" ng-model="result" typeahead="patient as patient.first_name for patient in ngGridUsersData.patients | filter:{first_name:$viewValue}" typeahead-template-url="customTemplate.html">
我会在typeahead
字段中添加什么以在 last_name 中进行搜索?我将在模板中添加什么以在选择时同时显示名字和姓氏?
如果 angular-ui 指令没有此功能,那么我想我只会将名字和姓氏连接成一个字符串。
更新: 2014 年 9 月 15 日知道如何在搜索结果中显示名字和姓氏吗?