Trying to filter a list of items from my Firebase database based on location.liked === true has been a challenge for me. I've attempted using the traditional filter array method but have not had success. Can anyone suggest an alternative method to accomplish this task?
this.locations = af.database.list('/trips')
.map((locations) => {
return locations.map((location) => {
location.liked = af.database.object(`/likes/${this.uid}/${location.$key}`);
return location;
})
});
Initially, I tried implementing the following logic:
this.filteredResult = locations.map((locations) => {
return locations.filter((location) => {
return location.liked
})
})
However, I encountered an error stating that any[] cannot be filtered.