angularfire2

How to Store Credentials to Local Storage to Allow Firebase Auth to Sign-in

半城伤御伤魂 提交于 2021-02-05 08:35:30
问题 I'm working in an Angular 10 project, I am also using firebase hosting and cloud firestore (for DB). I am using AngularFire in my project as well. My project is already able to get documents from my firestore collection, and display them (also can edit, delete, and create them). I also set up authentication, where I use AngularFireAuth to sign in and sign out. I also have route guards to only allow users access to info after signing in. I've discovered that Firestore also has rules, and that

How to Store Credentials to Local Storage to Allow Firebase Auth to Sign-in

荒凉一梦 提交于 2021-02-05 08:34:47
问题 I'm working in an Angular 10 project, I am also using firebase hosting and cloud firestore (for DB). I am using AngularFire in my project as well. My project is already able to get documents from my firestore collection, and display them (also can edit, delete, and create them). I also set up authentication, where I use AngularFireAuth to sign in and sign out. I also have route guards to only allow users access to info after signing in. I've discovered that Firestore also has rules, and that

angular using an observable within an observable

一世执手 提交于 2021-02-04 21:32:44
问题 I am making an expense manager webapp with angular 6. My database is on firebase. I am using the angularfire2 lib to retrieve and update the data. the database is designed as follows the function to get a category is getCategory(uid:String,categorykey:string):Observable<any> { return this.afdb.object(`users/${uid}/categories/${categorykey}`) .snapshotChanges() .pipe(map(c=>({key:c.payload.key,...c.payload.val()})));} the function that returns observable with an array of expenses is

angular using an observable within an observable

ⅰ亾dé卋堺 提交于 2021-02-04 21:32:35
问题 I am making an expense manager webapp with angular 6. My database is on firebase. I am using the angularfire2 lib to retrieve and update the data. the database is designed as follows the function to get a category is getCategory(uid:String,categorykey:string):Observable<any> { return this.afdb.object(`users/${uid}/categories/${categorykey}`) .snapshotChanges() .pipe(map(c=>({key:c.payload.key,...c.payload.val()})));} the function that returns observable with an array of expenses is

Warning “It looks like you're using the development build of the Firebase JS SDK” in Angular firebase app

自闭症网瘾萝莉.ら 提交于 2021-01-29 22:37:29
问题 I'm using angular fire sdk in my angular project. But it trigger following warning. I searched about this problem and get answers. But those answers cannot apply to angular project. It looks like you're using the development build of the Firebase JS SDK. When deploying Firebase apps to production, it is advisable to only import the individual SDK components you intend to use. For the module builds, these are available in the following manner (replace <PACKAGE> with the name of a component - i

Angularfire snapshotChanges() vs Firestore javscript library onSnapshot()

蹲街弑〆低调 提交于 2021-01-29 21:20:50
问题 I found there's two realtime listener for firestore. Angularfire: snapshotChanges() Firestore javscript library: onSnapshot() Here is my question May I know what is the difference? How should I use them properly (I'm developing using Ionic + Cordova + Angular framework)? How to detach snapshotChanges()? Refer to Firestore documentation, I can detach onSnapshot() as per below. var unsubscribe = db.collection("cities") .onSnapshot(function (){ // Respond to data // ... }); // Later ... // Stop

Warning “It looks like you're using the development build of the Firebase JS SDK” in Angular firebase app

流过昼夜 提交于 2021-01-29 20:32:14
问题 I'm using angular fire sdk in my angular project. But it trigger following warning. I searched about this problem and get answers. But those answers cannot apply to angular project. It looks like you're using the development build of the Firebase JS SDK. When deploying Firebase apps to production, it is advisable to only import the individual SDK components you intend to use. For the module builds, these are available in the following manner (replace <PACKAGE> with the name of a component - i

How can I retrieve Firebase user properties?

↘锁芯ラ 提交于 2021-01-29 11:00:54
问题 Is there any way to retrieve Firebase user properties in Analytics for Firebase ? For example, Analytics has all user records. I want to retrieve a record about user information, such as country code, etc. using Analytics. Is there any API available for this? 回答1: Google Analytics for Firebase doesn't retain any PII (Personally Identifiable Information) about anyone using your app. It aggregates information across users. It doesn't associate specific user information from Firebase

Getting a single AngularFirestoreDocument from a AngularFirestoreCollection query

岁酱吖の 提交于 2021-01-29 10:42:01
问题 In Firestore, I have a uid as a field in my Vendor documents: /vendors +doc1 uid: 1 +doc2 uid: 2 To access the vendors, I'm using the following function: getVendor(index: string): AngularFirestoreDocument<Vendor> { return afs.doc<Vendor>(`vendors/${index}`); } I'd like to create a similar function, which also returns an AngularFirestoreDocument , but the function takes a uid to get the document: getVendorByUID(uid: string): AngularFirestoreDocument<Vendor> { ... return theDoc; } It seems like

Return a sub-collection in firebase using Angular firestore

 ̄綄美尐妖づ 提交于 2021-01-29 09:26:09
问题 I have a sub-collection called saved as a nested collection to each user. User has its own fields and a collection of saved which contains two fields and an array. I can display only user fields but i don't know a proper way to access each user sub-collection. export class SavedComponent implements OnInit{ public saved: Saved[]; public currentUser: any = null; public user: User; private subscriptions: Subscription[] = []; constructor( // Adding saved service private savedService: SavedService