[英]Typeahed in a drop-down angular js with data
I am new to angular js . 我是angular js的新手。 I have a drop-down , which contains more that 150 values . 我有一个下拉列表,其中包含150多个值。 I want to have a search for the dropdown attached with it . 我想搜索随附的下拉列表。 So , I have tried every thing,but i am not able to do . 所以,我已经尽力了,但是我却做不到。 So, my code is - 所以,我的代码是-
HTML - HTML-
<div class="select-container col-sm-12 label-container"
ng-disabled="!objectPropertyForm.selectedObjectProperty">
<span class="col-sm-4 text-right label-container">
<label>Value : </label>
</span>
<span class="col-sm-8">
<select
id="objectPropertyValueSelect"
name="objectPropertyValue"
class="btn btn-start col-sm-12"
ng-model="objectPropertyForm.selectedObjectPropertyValue"
ng-options="range as range.name for range in objectPropertyForm.selectedObjectProperty.rangeList |
filter:objectPropertyRangeFilter
track by range.name">
<option value="" disabled selected>Select your option</option>
</select>
</span>
</div>
controller - 控制器-
$scope.objectPropertyRangeFilter = function (value) {
return !($scope.objectPropertyForm.selectedObjectProperty
.values.includes(value.name));
};
if while typing it gives me the values , I want to have only that names in which the typed text is present . 如果在输入文字时给我值,我只想有出现文字的名字。 Any help will be appreciated. 任何帮助将不胜感激。
You can try https://material.angularjs.org/latest/demo/autocomplete similar solutions 您可以尝试https://material.angularjs.org/latest/demo/autocomplete类似的解决方案
or go for https://github.com/darylrowland/angucomplete 或去https://github.com/darylrowland/angucomplete
for which you have to provide $scope.localdata=your autofilldata 为此,您必须提供$ scope.localdata =您的自动填充数据
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.