未定义带有自动完成功能的角过滤器
Angular filter with autocomplete undefined
我试图从自定义过滤器中获得一些结果,其中包含输入和dropwon。输入输入应该会启动过滤器,并显示过滤的结果。下面是函数:
$scope.filterText = "";
$scope.filterDropdown = function(textTyped) {
var searchFilter = $scope.baseUrl + "&searchStr=";
return $http.get(searchFilter + textTyped, {
cache: true
}).then(function(data) {
$scope.results = data.data.data.data;
return $scope.results;
});
};
这里是html:
<input type="text" data-ng-model-options="{ updateOn: 'default blur', debounce: {'default': 500, 'blur': 0} }"
ng-model="item.search_value" placeholder="{{item.description}}" data-ng-change="filterDropdown(filterText)"/>
<div>
<ul data-ng-repeat="descriptions in results.description">
<li>{{descriptions}}</li>
</ul>
</div>
实际上我只能看到整个json的列表!我的意思是,当我开始键入时,函数启动但文本I类型不起作用,结果类似于:
http://192.168.1.121:8280/test/searchStr=
,其中每次输入一个单词时都应该填充searchStr。例如,我想搜索:hello。我将按"h"
http://192.168.1.121:8280/test/searchStr=h
然后http://192.168.1.121:8280/test/searchStr=he
http://192.168.1.121:8280/test/searchStr=hel
http://192.168.1.121:8280/test/searchStr=hell
http://192.168.1.121:8280/test/searchStr=hello
明白吗?我该如何修复?
在调用函数时需要传递ng-model name
data-ng-change="filterDropdown(item.search_value)
<input type="text"
data-ng-model-options="{ updateOn: 'default blur', debounce: {'default': 500, 'blur': 0} }"
ng-model="item.search_value" placeholder="{{item.description}}" data-ng-change="filterDropdown(item.search_value)"/>
相关文章:
- 添加文字和评论功能更新Div
- JavaScript打印功能使日历停止工作
- 每当您在选择器内移动鼠标时,悬停功能就会重复
- 如何防止网页加载后自动启动功能
- 除修剪外的其他功能
- 悬停功能触发器
- 为什么我的d3.jsselectAll+过滤器没有过滤
- 将IIFE的原始值存储在Angular中的监视功能(重置过滤器)中
- EXT JS : 数据存储过滤器功能不起作用
- 过滤器角度下拉功能取决于您之前选择的内容
- 如何在 ng-repeat中更新过滤器功能
- 访问过滤器功能内的变量
- AngularJS:过滤器更换时的触发功能
- 过滤器编号范围功能问题
- 控制器性能比较中的自定义过滤器与过滤器功能
- Angularjs过滤器的功能
- 如何使用javascript过滤器功能
- 未定义带有自动完成功能的角过滤器
- 过滤器功能在使用 Angular.js.and PHP 时无法按预期工作
- 简单的jQuery过滤器功能不能正常工作