自定义搜索功能在android 5.1及更低版本上不工作
Custom search function not working on android 5.1 and lower
我正在开发一个内置搜索功能的应用程序。但是,当我在Android 5.1或更低的模拟器(以及我的Nexus 7(2012)平板电脑运行Android 5.1)上执行搜索时,我得到一个错误,说"未定义的不是一个函数",这是在迭代的第一行,通过它必须搜索的列表。为什么这不是在所有的Android版本正常工作?
下面是我的代码:controllers.js
$scope.vacaturesZoeken = function() {
// Variable is value of search box
var zoekterm = document.getElementById('search_id').value;
// Check whether there is a proper search term in the variable
if (zoekterm.length === 0 || zoekterm.length === 1) {
// Variable is null, this will be used to check in the function
zoekterm = null;
}
// Search function
Vacatures.zoek($scope, zoekterm);
}
services.js
// Defining search function
zoek: function($VacatureZoekLijstscope, zoekterm) {
// Setting variable for found items to 0
searched.length = 0;
// For every item in vacatures
for (var i = 0; i < vacatures.length; i++) {
// When the box is checked to only search for location
if (document.getElementById("locatie_check").checked === true) {
// Here is where is checked whether the variable is null
if (zoekterm === null) {
return false;
}
// When the searchterm is in the location property of an item
else if (vacatures[i].locatie.toLowerCase().includes(zoekterm.toLowerCase())) {
// Add item to variable
searched.push(vacatures[i]);
}
}
谁能告诉我在5.1或更低版本的Android设备上使用这个是什么问题?提前感谢!
好的,问题是我使用了。includes()。此功能在Android 5.1及以下版本中无法使用
现在我使用。indexof() !== -1,这没有任何问题
相关文章:
- Chrome没有加载最新版本的web工作程序脚本(运行缓存版本)
- 如何使用多个jquery版本,以便Responsive Slides.js工作
- 安卓版本的代码不像桌面互联网浏览器那样工作
- 如何包含多个 jquery 版本以使多个 jquery 插件工作
- IE版本检查停止工作
- fadeIn动画无法在IE中工作(所有版本)
- 如何让原生 WebSocket 在 Android 4.03 及更高版本中工作
- ng-click在第一次点击后停止工作,但仅在以后的Angular版本中
- 正则表达式无法正常工作以识别 IE 版本
- 没有 jQuery 在 IE 版本 6 - 11 中工作
- 节点.js版本已更改,脚本不再工作
- 将 jQuery 库升级到版本 1.10 后,代码停止工作
- 版本号比较如何在 JavaScript 中正常工作
- 在JavaScript中检索innerHTML的输入值;在IE 9及以上版本中无法正常工作
- 窗口滚动在mozila最新版本中无法正常工作
- 获取.click()以在不同版本的Firefox中工作
- 不工作以前的页面功能在android旧版本像果冻豆,kitkat android,它的工作只有棒棒糖版本
- 当/patt/版本工作时,为什么RegExp版本不工作?(Javascript)
- senamion无法正常工作,浏览器版本出现错误
- createElement不能在ie8或更低版本中工作