请考虑我的html文件正文中的以下内容:
<html> ... <body> ... <div class='container-fluid' ng-controller="TypeaheadCtrl"> <input type="text" ng-model="selected" typeahead="name as entry.name for entry in entries | filter:{name: $viewValue} | limitTo:8" typeahead-on-select='onSelect($item,$model,$label)' class="form-control"> {{selection_made}} </div> <body> </html>
条目填充在其他地方.然后在控制器中:
angular.module('ui.bootstrap.demo').controller('TypeaheadCtrl',function($scope,$http) { ... $scope.onSelect = function ($item,$label) { $scope.$selection_made = $item; }; ... });
我有自动完成工作,但选择回调似乎不能正常工作.
我希望{{selection_made}}能够显示所选的内容,而是呈现文字文本{{selection_made}}.为什么?我错过了什么?
注意:我用this answer作为参考.
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。