angularfire2

Return nested collection from firestore as object for angularfire2 and firebase

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 12:47:08
问题 Let's say you have the following structure: shopping-carts (collection) - shopping-cart 1(doc) -- dateCreated (field) -- items (collection) - shopping-cart 2(doc -- dateCreated -- items . . . So, how would we go about getting the entire shopping-cart(doc) as an ShoppingCart object that we defined as export interface ShoppingCart { items: ShoppingCartItem[] dateCreated: string } afs.doc('shopping-cart/id').valueChanges() only returns the dateCreated afs.doc('shopping-cart/id').collection(

Angular 4 app on S3 denied access after redirect

a 夏天 提交于 2021-02-10 20:20:27
问题 I've built a simple angular 4 app that uses firebase as my authentication. And I use loginWithRedirect because loginWithPopup didn't work really on my cell phone. But the problem I'm running into is the redirect leaves the page, obviously, to authenticate, and then comes back to mysite.com/login but because its a SPA /login doesn't exist to the bucket I'm guessing. I've added this redirection rule, but it doesn't seem to be doing anything <RoutingRules> <RoutingRule> <Condition>

Angular 4 app on S3 denied access after redirect

懵懂的女人 提交于 2021-02-10 20:18:34
问题 I've built a simple angular 4 app that uses firebase as my authentication. And I use loginWithRedirect because loginWithPopup didn't work really on my cell phone. But the problem I'm running into is the redirect leaves the page, obviously, to authenticate, and then comes back to mysite.com/login but because its a SPA /login doesn't exist to the bucket I'm guessing. I've added this redirection rule, but it doesn't seem to be doing anything <RoutingRules> <RoutingRule> <Condition>

Data is not showing. Ng-reflect-ng-for-off:null?

﹥>﹥吖頭↗ 提交于 2021-02-08 10:08:46
问题 Hi i am trying to bind a data from firebase. And I'm not getting errors but data is not showing. In inspect element i'm getting <!--bindings={ "ng-reflect-ng-for-of": null }--> My app.component.html is <ul> <li *ngFor="let item of items | async"> {{item.title}} </li> </ul> and my app.component.ts is import { Component } from "@angular/core"; import { AngularFirestore } from "angularfire2/firestore"; import { Observable } from "rxjs/Observable"; import { AngularFire, FirebaseListObservable }

Sort an array with integers and letters alphabetic in Angular / Typescript

回眸只為那壹抹淺笑 提交于 2021-02-08 03:42:26
问题 What I plan to do I try to sort an array like this... 1 2 2(a) 2(b) 2(b) #AsimpleName 2(b) #NameWithN 3 4 4(a) ... ... in Angular2. My Current Code Component this.streetDetailRef = this.afDatabase.list('data/users/' + this.currentUserID + '/territory/' + this.sStreet.parentKey + '/' + this.sStreet.key + '/houseNumbers/'); this.streetDetailData = this.streetDetailRef.snapshotChanges().map(changes => { return changes.map(c => ({ key: c.payload.key, ...c.payload.val() })).sort(); }); The loop in

Casting firestore observables to custom objects

↘锁芯ラ 提交于 2021-02-07 19:56:27
问题 I'm new to angular and firestore and trying to figure out how to cast the data received from firebase directly to models. What is the best approach here? Currently I get the data, but it looks like it's not casted into a Blimp object. When I try to call getImageUrl() on it in the view, I get the following error message. ERROR TypeError: _v.context.$implicit.getImageUrl is not a function So my question: What is the best and cleanest way to cast these observables to the correct local model? I

Is There Such A Thing As “Multi-Path Push” in Firebase Real-Time Datasbase?

爷,独闯天下 提交于 2021-02-07 14:20:43
问题 I was watching this video which talks about multi-path updates in Firebase. Multi-path updates are great because they allow you to call the firebaseRef.update() method two or more times while having them be one atomic, all-or-nothing operation. This is great, but in my current situation I don't want to use the update() method. Instead, I want to use the FirebaseRef's push method and allow Firebase to generate a unique key for my object. The tricky part is that I have denormalized my data so

RxJS - switchMap not emitting value if the input observable is empty array

岁酱吖の 提交于 2021-02-07 07:32:11
问题 I have the setup where I query firebase for list of user favourite posts. Basically, at first I query for user likes and then for each like get the corresponding post - all in one observable sequence. The problem arises when user dislikes the only left post. In that case (when the likes array becomes empty) nothing is fired from the observable and view is not updated (there is always at least one post present). On the one hand, this behaviour seems logical and understandable, but on the other

Firebase Firestore - security rule based on “where” query parameters

痴心易碎 提交于 2021-02-05 11:31:40
问题 I'm trying to secure requests to a collection to allow any single get , but to allow list only if a specific key is matched. Database structure is like this: posts post1 content: "Post 1 content" uid: "uid1" post2 content: "Post 2 content" uid: "uid1" post3 content: "Post 3 content" uid: "uid2" The Firestore query I'm making from Vue: // Only return posts matching the requested uid db .collection("posts") .where("uid", "==", this.uid) The security rules I'd like to have would be something

Ionic 3 firebase doesn't show that email is verified

↘锁芯ラ 提交于 2021-02-05 11:09:49
问题 I've run into a problem during development of email verification with firebase. Whenever I try to verify the email address, I can't get the info that user's email address is verified. I have a code like this: constructor(private afAuth: AngularFireAuth, public navCtrl: NavController, public navParams: NavParams) { } ionViewWillEnter() { this.afAuth.auth.onAuthStateChanged(user => { if (user && user.emailVerified) { this.navCtrl.setRoot(ShoppingListPage); } }); } proceedButtonHandler() { this