angularfire2

Access scope data after Firebase authentication

女生的网名这么多〃 提交于 2019-12-22 09:28:29
问题 I authorized the calendar api in my google sign in auth, using the following code (Angularfire2): let auth = new firebase.auth.GoogleAuthProvider(); auth.addScope('https://www.googleapis.com/auth/calendar'); this.afAuth.auth .signInWithPopup(auth).then((data) => { console.log(data); // nothing about calendar here }); Is there any way to access authorized scopes using FirebaseAuth? For example, access the calendar data after the user signs and authorizes the calendar auth. 回答1: If you check

How can I use two translators first for JSON file and second for firestore?

扶醉桌前 提交于 2019-12-22 01:32:02
问题 JSON File Method export function createTranslateLoader(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } JSON File Loader TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: (createTranslateLoader), deps: [HttpClient] } }), AngularFirestore Method export function FirestoreTranslationsLoaderFactory(db: AngularFirestore) { return new FirestoreTransLoader(db); } AngularFirestore File Loader TranslateModule.forRoot({ loader: { provide:

Can not have access to multiple Google Firestore DB in Angular 6 application with angularfire2

可紊 提交于 2019-12-21 22:41:58
问题 I try to have access to multiple Google Firestore DB from my Angular 6 application through angularfire2 package. I initialized multiple instance of AngularFireModule in app.module.ts but couldn't find a way to have access to both DBs: @NgModule({ declarations: [ ... ], imports: [ ... AngularFireModule.initializeApp(coolStoreConfig, 'coolStore'), AngularFireModule.initializeApp(perfectStoreConfig, 'perfectStore'), ... ], ... }) Any idea? 回答1: After some searches around, the following answer

Property 'subscribe' does not exist on type Auth

 ̄綄美尐妖づ 提交于 2019-12-21 21:36:07
问题 With the code below, I am getting the error Property 'subscribe' does not exist on type Auth . If I remove the entire block of subscribe code from app.component.ts then I am getting no error, but the browser is opening directly on the home page and not the login page. At the bottom of app.component.html I have included <router-outlet></router-outlet> , app.component.ts import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { Observable } from 'rxjs

How to instantiate Firebase Cloud Messaging in Angular2

巧了我就是萌 提交于 2019-12-21 12:29:48
问题 How to instantiate Firebase Cloud Messaging in Angular2 / TypeScript / AngularFire2 ? It's described here for JavaScript: https://firebase.google.com/docs/cloud-messaging/js/client 回答1: The firebase.messaging() function takes the Firebase app instance as an optional parameter. To wire it up with AngularFire2 , you could let AngularFire2 perform the app initialization and create the Firebase app instance and could then inject the app instance (into a service, for example) and pass it to

how to get data within firebase, when we have many to many relationship

老子叫甜甜 提交于 2019-12-21 05:39:06
问题 I read this question Many to Many relationship in Firebase, and here describes how to create or structure many to many relationship within firebase(nosql database), and it is pretty easy, companyContractors companyKey1 contractorKey1: true contractorKey3: true companyKey2 contractorKey2: true contractorCompanies contractorKey1 companyKey1: true, companyKey2: true contractorKey2 companyKey2: true contractorKey3 companyKey1: true but when i want to get all contractors specific company, can i do

How to get firestore timestamp

ぐ巨炮叔叔 提交于 2019-12-21 05:35:11
问题 I'm trying to get the timestamp of a document that I created in firestore, but what I get is this: myService.ts getDomiciliarios() { this.domiciliarios = this.afs.collection('domiciliarios').snapshotChanges().map(actions => { return actions.map(a => { const data = a.payload.doc.data() as Domiciliario; const id = a.payload.doc.id; const date = firebase.firestore.FieldValue.serverTimestamp(); return { id, ...data, date }; }); }); return this.domiciliarios; } myComponent.ts ngOnInit() { const

AngularFireList is not assignable to type 'Observable<Response>

≯℡__Kan透↙ 提交于 2019-12-21 04:25:11
问题 I have an Ionic page which is querying FirebaseListObservable to make dynamic searching on ion-searchbar. It works well with Angularfire2@4.0.0-rc.0 and firebase@4.5.0. After upgrading new release AngularFire 5.0 I get an issue about FirabaseListObservable has no exported from new Api. import { Component } from '@angular/core'; import { IonicPage, NavParams, ViewController } from 'ionic-angular'; import {AngularFireDatabase, FirebaseListObservable} from 'angularfire2/database'; import {

'query' does not exist in type 'QueryFn' | angularfire2

早过忘川 提交于 2019-12-21 02:59:11
问题 Argument of type '{ query: { limitTolast: number; orderByKey: boolean; }; }' is not assignable to parameter of type 'QueryFn'.Object literal may only specify known properties, and 'query' does not exist in type 'QueryFn'. package.json "angularfire2": "^5.0.0-rc.3", "firebase": "^4.5.1", chat.service.ts getMessages(): FirebaseListObservable<ChatMessage[]> { return this.db.list('messages', { query: { limitTolast : 25, orderByKey: true} }); } 回答1: It's not working, because AngularFire expects a

How to save date in Angular as a timestamp to Firestore?

偶尔善良 提交于 2019-12-20 04:58:08
问题 I am trying to save personal info of person with birth date and activation date into Firestore database in Angular; However, passing object with Date() type fields the dates are saved as a string: this.treatment.activationDate = new Date(); // gives such result in firestore with string type // activationDate: "2018-11-16T09:48:51.137Z" Also tried to use server timestamp, but the following method does not return valid value: firebase.firestore.FieldValue.serverTimestamp() Result in Firestore