ios - custom filter won't update live results on iPhone -
Update: I have a basic search field that matches the name Shows from the JSON array of employee data: It works fine, but because it is mobile, I wanted to reduce the size of the JSON download as much as possible. Since the I have created a custom filter: And my idea has been updated to use it: This works as expected on my desktop browser - results are live-updated as the text is typed. But on mobile, it no longer displays any results, whether the keyboard is open or not. It happens in both Safari and Chrome (iOS 8.0.2). I tried, but he did not change anything. (I am currently using AngularJS 1.3.0-rc.4.) Why Does AngularJS Implicit Filter Updates Live Results But Does not My Custom Filter? And why does this happen only on mobile? Have you tried to ensure that both input and search strings were set to lowercase Is: I realized that the first letter of my phone was auto-capitalizing and was not intended to show results. If it is not, then you may need to enter some more information about how data is getting there.
& lt; Form & gt; & Lt; Label & gt; Enter name: & lt; Input type = "article" ng-model = "search" & gt; & Lt; / Labels & gt; & Lt; / Form & gt; & Lt; ul class = "result-container" ng-if = "search.length & gt; 1" & gt; & Lt; li class = "results" ng-repeat = "employees in staff | filter: {full_name: search}" & gt; & Lt; / Ul & gt;
full_name field on-the-fly has been created as a combination of
first_name and
last_name , so that's why I
app.philter ('first andlastname', function () {return function () archive , str) {return collection.filter (function (el) {// javascript array.filter () returns (el.first_name.toLowerCase). IndexOf (str)! == -1 || el.last_name.toLowerCase () .indexOf (str)! == -1);});};});
& lt; li class = "results" ng-repeat = "emp | first andListName in employee: search" & gt;
app.filter ('first andlastname', function) {return function (archive, str) {var strToLower = str.toLowerCase (); return collection.filter (function (l) {// javascript array.filter () returns (lfst_name.lower cas (). indexoff (strotollaver)! == -1l.lust_name.lalvercas (). indexoff ( Stratolver)! == -1);});};});
Comments
Post a Comment