I have two tabs with different list created by ng-repeat
When I'm filtering second tab - everything works properly, but first one does not work at all.
I now that problem is because of <ul search-list=".letter" model="search.district">
and <input id="q" type="text" ng-model="search.district " />
, but search.district
I need for second tab correct filtering. If you will change search.district
on search
- filtering will work on both tabs, but on second tab filtering won't be correct (filter should filters districts, and when we click on Z
it shows all cities with letter z
).
So, question is, how to leave search.district
in my code, and how to make filter works correct in both tabs?
Here is working DEMO
Thanks a lot in advance!
In the startWith
function you assume expected
is String, but for first panel comparison is an object, change code like this:
var e = angular.isString(expected) ? expected.toLowerCase() : expected.district.toLowerCase();
Then use e
variable as indexOf
parameter.