考虑我的正文中的以下内容html
file:
<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>
where entries
居住在其他地方。然后在控制器中:
angular.module('ui.bootstrap.demo').controller('TypeaheadCtrl', function($scope, $http) {
...
$scope.onSelect = function ($item, $model, $label) {
$scope.$selection_made = $item;
};
...
});
我的自动完成功能可以正常工作,但选择回调似乎效果不佳。
我正期待着{{selection_made}}
显示所选内容,而不是文字{{selection_made}}
被渲染。为什么?我缺少什么?
注:我用过这个答案 https://stackoverflow.com/a/17994624/283296以供参考。
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)