angularfire2

Firebase firestore not working with Angular Universal: package.json does not exist

 ̄綄美尐妖づ 提交于 2020-08-07 13:34:40
问题 I followed this tutorial for creating server side rendered app. After that I run npm install firebase @angular/fire --save and import the modules in the AppModule like this import { AngularFireModule } from "@angular/fire"; import { AngularFirestoreModule } from "@angular/fire/firestore"; import { AngularFireStorageModule } from "@angular/fire/storage"; AngularFireModule.initializeApp(environment.firebase), AngularFirestoreModule, AngularFireStorageModule, The error occurs when I try to serve

How to perform dynamic where queries with firestore and add indexes

£可爱£侵袭症+ 提交于 2020-08-04 05:14:50
问题 In my site i am conducting a survey like tests , each test has attendies sub collection look like this When someone finishes a test i also add their uid to completed field like i drawn in the box. Now i want to query tests based on status == completed . Here is what i tried this.completedModulesRef$ = this.afs.collection('tests', ref => ref.orderBy('moduleNum', 'desc') .where('completed.'+auth.uid+'.status','==','completed')); this.completedModules$ = this.completedModulesRef$.valueChanges();

Changing the domain shown by Google Account Chooser

蓝咒 提交于 2020-07-28 00:17:25
问题 In a web app we are using Firebase Auth to manage logins and (basic) account creation. When using the Google Login option with the user active with more than one Google account, the user is shown the Google Account Chooser to choose which of the accounts to use on our site. Its heading looks something like this: Choose an account to continue to mydomain.com In my web app's case, instead of showing mydomain.com , it is showing <firebase-project-id>.firebaseapp.com . What do I have to do to

Changing the domain shown by Google Account Chooser

杀马特。学长 韩版系。学妹 提交于 2020-07-28 00:13:30
问题 In a web app we are using Firebase Auth to manage logins and (basic) account creation. When using the Google Login option with the user active with more than one Google account, the user is shown the Google Account Chooser to choose which of the accounts to use on our site. Its heading looks something like this: Choose an account to continue to mydomain.com In my web app's case, instead of showing mydomain.com , it is showing <firebase-project-id>.firebaseapp.com . What do I have to do to

Property 'onSnapshot' does not exist on type 'AngularFirestoreCollection<unknown>'

限于喜欢 提交于 2020-07-22 08:49:04
问题 I am trying to detach listener from cloud Firebase, but I still get this error. Property 'onSnapshot' does not exist on type 'AngularFirestoreCollection' Do you know, what sould I import? I directly copy this code from Firebase documentation. let unsub = this.firestore.collection('cities').onSnapshot(() => { }); // Stop listening for changes unsub(); This is my constructor and import: import { AngularFirestore } from "@angular/fire/firestore"; constructor(public firestore: AngularFirestore) {

AngularFirestore - Update query dynamically

允我心安 提交于 2020-07-20 03:42:20
问题 I have the following query: loadData(settings: any): Observable<any[]> { const ref = this.db.collection('data').ref .orderBy('simpleID', 'desc') .where('isVerified', '==', true) .limit(5); // Gender filter if (settings.includeMales && !settings.includeFemales) { ref.where('gender', '==', 'm'); } else if (!settings.includeMales && settings.includeFemales) { ref.where('gender', '==', 'f'); } return this.db.collection('confessions', ref => ref) .valueChanges(); I want to apply filters

Display duplicate events after update firestore data, but the data itself in firestore isn't duplicated

旧街凉风 提交于 2020-06-25 07:32:07
问题 I have a web application(Angular) and mobile application(Ionic). Both of them share the same Firestore data. Use web application update existing data but the ionic app shows duplicate items(the duplicates will be gone after restart the mobile app), I check the item data itself in Firestore, it was updated and unique. Does anyone have any clue on this? This issue only occurs on the mobile app other than the web app, both of them use "angularfire2": "^5.0.0-rc.4", import { AngularFirestore,

How to to set firebase database rules to secure data per user?

こ雲淡風輕ζ 提交于 2020-06-17 01:49:51
问题 I'm new to Firebase, and I'm trying to understand rules where authenticated user id is to be used for securing data. I'm using Angularfire2 on the client. And I'm using email/password authentication, which works fine. If I set my database rules to allow read and write for authenticated users, everything works fine, and I end up with the following data in the Firebase database... { "notes" : { "-KmgjG9hxoXOTtuLTItz" : { "content" : "test", "title" : "Test note 1", "uid" :

Trying to set up Cloud Firestore security rules using request.path

偶尔善良 提交于 2020-06-16 19:09:22
问题 I am struggling to get my head around some Firestore security concepts. I want to set up a rule based on the request.path property. My rule is this: service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.path[0]=='appUsers'; } } } ...and I then use AngularFire2 to add a document like this... this.myAngularFirestore.doc('/appUsers/'+this.auth.auth.currentUser.uid).set({name: this.auth.auth.currentUser.displayName}) .then(()=

ReferenceError : XMLHttpRequest is not defined when running my angular 6 universal app

落花浮王杯 提交于 2020-05-29 07:44:31
问题 I have made a Angular 6 project with dependency Angularfire2 . I am using firestore and firebase storage. I have converted my app to angular universal and when i run server.js it says listening on localhost:4000 but as soon as i open the browser with localhost:4200 the terminal shows the following error: ReferenceError: XMLHttpRequest is not defined here is the snippet of the error 回答1: Install these dependencies: npm install --save-dev ws xmlhttprequest Then add this to your server.ts file