I'm using Ionic2 / Angular2
with typescript
and I have a problem while filtering an Array.
I have
let localTours = [];
...
let newTours = dbTours.filter(x => localTours.indexOf(x) < 0);
localTours.push(newTours);
In this example my localTours
is always empty, because the .push
is called before the filtering. Any idea how to solve this?
Either your filtering is wrong and is filtering EVERYTHING thus giving you an empty array as a result, OR your something function is async, in which case you would benefit from using something like the async.js library and so something like:
And your something function, looks like: