bootstrap ui - typeahead onselect,不显示自定义值
bootstrap ui - typeahead onselect, custom value is not displayed
我正在尝试使用 bootstrap 添加自动完成功能。当从自动完成列表中选择一个值时,我想在所选值的末尾附加一个“:”。出于某种原因,此附加不起作用。
我的 angular html 代码是
<input type="text" ng-model="query" id="search_es"
typeahead="v for v in getNext($viewValue) | filter: type_filter"
typeahead-on-select='onSelect($item, $model, $label)'
autocomplete = "off"
placeholder="Type to search..." />
<div my-search-directive="search_radar"></div>
这里是onSelect的js代码
$scope.onSelect = function($item,$model,$label) {
$scope.query += ": ";
}
我可以在另一个变量中捕获查询的值,并可以显示在 UI 上,但显示在 bootstrap 打字头文本框中。
我正在使用 angular1.4.7
ui-bootstrap-tpls-0.14.3.min.js
谁能帮忙。
您的 $scope.onSelect
函数在此 modified ui-bootstrap example plunker 中按预期运行。我了解到您发现了阻止预期行为的条件,做得很好。
我正在尝试使用 bootstrap 添加自动完成功能。当从自动完成列表中选择一个值时,我想在所选值的末尾附加一个“:”。出于某种原因,此附加不起作用。
我的 angular html 代码是
<input type="text" ng-model="query" id="search_es"
typeahead="v for v in getNext($viewValue) | filter: type_filter"
typeahead-on-select='onSelect($item, $model, $label)'
autocomplete = "off"
placeholder="Type to search..." />
<div my-search-directive="search_radar"></div>
这里是onSelect的js代码
$scope.onSelect = function($item,$model,$label) {
$scope.query += ": ";
}
我可以在另一个变量中捕获查询的值,并可以显示在 UI 上,但显示在 bootstrap 打字头文本框中。
我正在使用 angular1.4.7 ui-bootstrap-tpls-0.14.3.min.js
谁能帮忙。
您的 $scope.onSelect
函数在此 modified ui-bootstrap example plunker 中按预期运行。我了解到您发现了阻止预期行为的条件,做得很好。