My method returns an Observable array from Firebase. I have decided to filter the data in the client rather than in the server. My problem is that I want to get only the data if the attribute "attending = true". Any help or other approach is highly appreciated. Thank you very much.
The method below get the data from the firebase real-time database
userEvents: Observable<any[]>;
getUserEvents(uid: string) {
this.userEvents = this.db.list(this.basePatheventsSaved, ref=>
ref.orderByChild('uid').equalTo(uid)).snapshotChanges().map((actions) => {
return actions.map((a) => {
const data = a.payload.val();
const $key = a.payload.key;
return { $key, ...data };
});
});
return this.userEvents;
}
The code below is used to fecth the data to be used in the templaTe:
userEvents: Observable<any[]>;
constructor(public auth: AuthService, private upSvc: FilesServiceService) {
this.userEvents = this.upSvc.getUserEvents(this.auth.currentUserId);
}