Looking to retrieve all users from a Firebase realtime database and organize them based on a score property. I managed to achieve this by using the variable
users: FirebaseListObservable<any[]>;
however, encountered the following errors:
Type 'Observable<any[]>' is not assignable to type 'FirebaseListObservable<any[]>'.
Property '_ref' is missing in type 'Observable<any[]>'.
Switching the variable to
users: Observable<any[]>;
resolves the errors, but limits the use of Angularfire methods like .push()
and .update()
.
The fetching and sorting code (proven to work) is as follows:
this.users = this.af.database.list('/users')
.map(items => items.sort((a, b) => b.score - a.score));
Seeking advice on the correct approach to avoid errors, or any recommended methods. Thank you!