angularfire2

Leaderboard ranking with Firebase

自闭症网瘾萝莉.ら 提交于 2019-12-17 05:48:06
问题 I have project that I need to display a leaderboard of the top 20, and if the user not in the leaderboard they will appear in the 21st place with their current ranking. Is there efficient way to this? I am using Cloud Firestore as a database. I believe it was mistake to choose it instead of MongoDB but I am in the middle of the project so I must do it with Cloud Firestore. The app will be use by 30K users. Is there any way to do it without getting all the 30k users? this.authProvider.afs

firebase realtime DB querying date between 2 dates does not match anything

北战南征 提交于 2019-12-13 20:26:26
问题 I am trying to find all the objects that are between two dates. the code look like below getPendingOrders(dateFrom:number, dateTo:number){ console.log('start of getPendingOrders with dateFrom:' + dateFrom + " dateTo:" + dateTo) return new Promise((resolve, reject) => { this.db.list('orders', ref => ref.orderByChild("order/_date").startAt(dateFrom).endAt(dateTo) ).snapshotChanges().subscribe( res => { console.log('response:' + JSON.stringify(res)) resolve(res) }, err => { console.log(err)

Get list of list firebase

你离开我真会死。 提交于 2019-12-13 17:19:47
问题 I am creating Ionic app with database on Firebase,so I have something like this in Firebase, and I am using angularfire2 to get the data and I have no problem on getting paises but I have tried getting the list of jugadores but I get nothing. This is my .ts export class HomePage { paises: Observable<any[]> constructor(public navCtrl: NavController, db: AngularFireDatabase) { this.paises = db.list('paises').valueChanges(); } } and this is my .html <ion-content *ngFor="let pais of paises |

Is the Firebase Storage getDownloadURL() re-usable, or should it always be regenerated?

情到浓时终转凉″ 提交于 2019-12-13 15:08:49
问题 Is this a good practice to save in the database and reuse the url returned by angularfire2's getDownloadURL() rather than executing getDownloadURL() every time I need to display an image from Firebase Storage? If I use getDownloadURL() in my component, images are reloaded every time I access the component. I would like to avoid that. If I save the url in my database after the image was uploaded and then use this url every time I need to display the image this solves the problem. However,

Lazy load Firebase

允我心安 提交于 2019-12-13 07:26:17
问题 I'm creating a chat app in Angular 4 which stores and reads messages in and from the Firebase database. I've written a query to retrieve only the latest 10 messages of that specific conversation. this.messages = this.db.list('messages/' + conversationId, { query: { limitToLast: 10 } }); db: AngularFireDatabase, messages: FirebaseListObservable Now I want to retrieve the 10 older messages when somene presses the 'more' button (or scrolls to the top) and I'm having difficulties writing a query

How do I use .take on FirebaseListObservable?

社会主义新天地 提交于 2019-12-13 06:44:37
问题 If I try to use RxJS operators like .take, .skip, etc. on FireBaseListObservable, I get "take is not a function" error: import {Component} from '@angular/core'; import {AngularFire, FirebaseListObservable} from 'angularfire2'; import {Observable} from 'rxjs'; export class AppComponent { items: FirebaseListObservable<any>; constructor(public af: AngularFire) { // this works Observable.interval(1000).take(5).subscribe(x => console.log(x)); this.items = af.database.list('/items'); // this does

Firebase / Angularfire2: nested data nodes in firebase

喜夏-厌秋 提交于 2019-12-13 03:35:34
问题 i've got a firebase database. a node called /config// which holds userspecific data. i now want to add a subtree to the userdata with a list of cars, like /config//cars/: "config" : { "NE5AwHcxKofMPKRCAvny5Re4MtG3" : { "geburtstag" : "2017-06-04", "nachname" : Mueller", "cars" : { "-Krr2-DC1uoqCvgVJhFL" : { "name" : "Ford Mustang" }, "-Krue4_5kJQhis-3Qg1X" : { "name" : "Toyota Supra" } } } i created a observable binding to /config/ this.$ref = this.database.object('/config/' + uid); this.data

Edit in angular 4

笑着哭i 提交于 2019-12-13 03:03:38
问题 I am working on Angular 4 project. Here I want to update the form data using firebase key I have pass the data through component.ts as follow this.service.editEnquiry(this.data); I called editEnquiry() of service. the editEnquiry() is given as follows editEnquiry(data) { console.log(data); console.log(data.key); this.af.list(`/enquirydata/`+key).update(data); } I am getting the data in editEnquiry() but its not updating the record in firebase. Its giving me error like this Supplied parameters

Is possible to store firebase data & run the application functions in offline mode in Ionic 2?

眉间皱痕 提交于 2019-12-13 00:09:12
问题 I found some tutorials about offline mode firebase for Ionic 2 but still I don't know how can I enable this thing in my application. So, Is firebase realy support offline mode? If yes, can I store all recieved data and run the functions in offline mode ? 回答1: There is no official support yet from firebase.But you can do that using angularfire2-offline library. A simple wrapper for AngularFire2 to read and write to Firebase while offline, even after a complete refresh. Here is a great article

Query data relationship on Firebase Realtime Database with angularfire2

泪湿孤枕 提交于 2019-12-12 20:14:18
问题 I need to query comments and request only user that listed in the comment by userId. My database structure in Firebase realtime db: { "comments" : { "c_id1" : { "commentId" : "c_id1", "commentText" : "text", "userId" : "u_id1" }, "c_id2" : { "commentId" : "c_id2", "commentText" : "text", "userId" : "u_id3" }, }, "users" : { "u_id1" : { "userId" : "u_id1", "userName" : "name1", }, "u_id1" : { "userId" : "u_id2", "userName" : "name2", }, "u_id1" : { "userId" : "u_id3", "userName" : "name3", } }