angularfire2

How to get do a join in angularfire2 database

点点圈 提交于 2019-11-27 08:59:09
I have searched through and I still couldn't get the right answer. I will be happy you point me to the right direction. I have a database with users and projects pojects: 08177a0acb3f4d96f8cb5fa19002d2ed: pid: 08177a0acb3f4d96f8cb5fa19002d2ed, pName: "Prject 1" uId: "254", createdAt: 9377476 users: 254: userName: "Eric" uId: "254" avatar: "image.jpg" Now I want to display my projects, I do a list retrieve in my service this.projectList = this.af.database.list('projects', { query: { orderByChild: 'createdAt' } }); getProjects() { return this.projectList.map(snapshot => { return snapshot; });

Firebase Custom Claims doesn't propagate

限于喜欢 提交于 2019-11-27 08:36:25
问题 I'm working in an Angular6 app with angularfire2. I'm setting the roles as custom claims in user creation, but it doesn't seem to propagate. When I'm creating the user I send the userid, businessid and role to a cloud function: bid > businessid urole > role req.body.uid > userid const customClaims = { roles: { [bid]: urole } } admin.auth().setCustomUserClaims(req.body.uid, customClaims) .then(result => { res .status(200) .send() }) The problem is when the call to cloud function finishes and I

FirebaseList - Unable to access parse data fetched from firebase

感情迁移 提交于 2019-11-27 08:08:39
问题 I'm getting " Error: InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe' " when running the following code. html template: <ion-list> <ion-item-sliding *ngFor="let item of shoppingItems | async"> <ion-item> {{ item.$value }} </ion-item> <ion-item-options side="right"> <button ion-button color="danger" icon-only (click)="removeItem(item.$key)"><ion-icon name="trash"></ion-icon></button> </ion-item-options> </ion-item-sliding> </ion-list> page ts: shoppingItems: AngularFireList<any>;

Joining Flattened Data

北城以北 提交于 2019-11-27 04:52:02
i'd like to join the data on init from my customers table into the projects list. Model is like this: projects key name: string customer : customerKey customers key name: string Do you have an example, how i do this from angular2 component using angularfire2? my controller looks like this: import { Component, OnInit } from '@angular/core'; import { Project } from '../project'; import { Router } from '@angular/router'; import { FirebaseAuth } from 'angularfire2'; import { AngularFire, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2'; import { Observable } from 'rxjs';

No provider for AngularFireDatabase, AngularFireAuth

久未见 提交于 2019-11-27 01:20:35
Apologies as I can't think of a better way of including all the information... When I run this, I get an error saying the following. I've followed the Ionic Docs to the T, I can't figure out what could possibly be wrong. Error: No provider for AngularFireDatabase! Package.json App.module.ts Home.html Home.ts AngularDatabase ( same for AngularAuth ) is separated to its own module AngularFireDatabaseModule ( AngularFireAuthModule for AngularAuth ) from version angularFire2@4.0.0 , see documentation here . you should import AngularFireDatabaseModule ( AngularFireAuthModule for Authentication ) in

Firestore slow performance issue on getting data

╄→尐↘猪︶ㄣ 提交于 2019-11-27 00:02:39
I'm having slow performance issues with Firestore while retrieving basic data stored in a document compared to the realtime database with 1/10 ratio. Using Firestore, it takes an average of 3000 ms on the first call this.db.collection(‘testCol’) .doc(‘testDoc’) .valueChanges().forEach((data) => { console.log(data);//3000 ms later }); Using the realtime database, it takes an average of 300 ms on the first call this.db.database.ref(‘/test’).once(‘value’).then(data => { console.log(data); //300ms later }); This is a screenshot of the network console : I'm running the Javascript SDK v4.50 with

Firestore Getting documents id from collection

混江龙づ霸主 提交于 2019-11-26 22:46:50
问题 I'm trying to retrieve my documents with id but can't figure it out. Currently I retrieve my documents like this : const racesCollection: AngularFirestoreCollection<Races> = this.afs.collection('races'); return racesCollection.valueChanges(); I do get my documents list perfectly, however there is no doc id with them. How can I retrieve it for each document ? 回答1: To obtain the id of the documents in a collection, you must use snapshotChanges() this.shirtCollection = afs.collection<Shirt>(

Leaderboard ranking with Firebase

久未见 提交于 2019-11-26 22:01:11
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.collection('profiles', ref => ref.where('status', '==', 1) .where('point', '>', 0) .orderBy('point', 'desc'

“ERROR TypeError: Object(…) is not a function” using AngularFirestore and firebase

谁说我不能喝 提交于 2019-11-26 18:56:53
I want to use firebase and angularfire2 in my app, first of all, I installed them, and for the declarations: in environment.ts export const environment = { production: false, firebase: { apiKey: 'sfsdfdsff', authDomain: 'sfsdfdf', databaseURL: 'https://ng-sfsdfsf.firebaseio.com', projectId: 'ng-fitnesssfsdfdsf', storageBucket: 'ng-fsdfsdfsfdecff5.appspot.com', messagingSenderId: '21331323' } }; in app.module.ts, imports: AngularFireModule.initializeApp(environment.firebase), AngularFirestoreModule in the component where want to get my data: import { AngularFirestore } from 'angularfire2

Firestore how to get the collection value from another collection document id is referenced

﹥>﹥吖頭↗ 提交于 2019-11-26 18:24:51
问题 I have two fire store collection with following reference image . I want to get the firstName and title . Here signup_id is referenced from coll-signup document id. Following code given below what i did. Model feed.ts export interface Feed { firstName? : string; signup_id? : string; title? : string; } news feed.component template <ul *ngFor="let feed of feeds"> <!-- <li>{{feed.firstName}}</li> --> // Here I want to print my first name <li>{{feed.title}}</li> <li>{{feed.signup_id}}</li> </ul>