AngularJS / Javascript: Find a string match in a nested object -
i have complex object (a user object) has nested arrays , nested objects within it.
i have search filter relatively complicated (checkboxes determining items returned, along search input).
currently search in object so:
for(var key in item){ if(item[key] && item[key].length && string(item[key]).tolowercase().indexof($rootscope.filt.searchfilter.tolowercase()) !== -1){ realsave = true; } }
however, works first layer of objects within item; need search objects within objects.
how can this? simpler way above? (note, can't use ng-repeat="item in items | searchfilter"
needs parse checkboxes , return values accordingly.
try
realsave = (json.stringify(item).indexof($rootscope.filt.searchfilter.tolowercase()) !== -1)
(it's long line, scroll right)
it transform whole object single string, can search sub-string you're looking anywhere inside it.
Comments
Post a Comment