ionic-filter-bar
ionic-filter-bar copied to clipboard
expression function is not receiving filterText param as in docs
Can you post the code you are using in your call to filterBar? If you take a look at the unit test, the following expression returns the filterText as the first arg. I just doubled checked and verified that its returning.
expression: function (filterText, value, index, array) {
return value.name.length >= 8 || value.description.indexOf(filterText) !== -1;
}
vm.filterBarInstance = $ionicFilterBar.show({
items: vm.gamesData,
expression: function (filterText, value, index, array) {
console.log(arguments.length);
console.log(arguments);
console.log(filterText);
return true;
//return value.game.name.indexOf(filterText) !== -1;
},
update: function (filteredItems, filterText) {
vm.gamesData = filteredItems;
}
});
and the console output
3
[Object, 1, Array[5]]
Object {game: Object, extra: Object, $$hashKey: "object:52"}
@vcalvello I am not able to see what your seeing.. when I add the exact same expression to the demo app in this repo, I get the following log for arguments when searching for "my search"
["my search", Object, 1998, Array[1999]]
Are you on the latest version? Pull down the demo, verify that you see what I'm seeing, then either try to see what the difference between your version and the demo version, or see if you can put a codepen together so I can look at it. Thanks!
@djett41 Seems to be something with the published component version. Everything fine using the repo src
@vcalvello Which version are you on? I tried both the unminified and minified dist but am seeing the correct behavior. Perhaps there was an issue with a previous version? Can you verify you're on the latest version? If you are still seeing the issue, If you can put together a codepen that I can replicate the issue I can look into it thanks!!
I can confirm this problem. The code in source is difference from latest release and using the source code everything works fine.