angularfire2

AngularFireDatabase Does not retrieve data

旧巷老猫 提交于 2019-12-04 17:14:32
Whenever I use afDB.list('/path') method, I get the following: console.log(this.items); and I have this example as my firebase database: listings file surprisingly, editing the data works perfectly fine (e.g. remove(), push(),... etc.), but I can't seem to be able to retrieve it; however, I can access it. I thought it might be a rules issue, yet, my rules are fine: firebase Rules this is the portion of the code that I'm having trouble with: import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import { AngularFireAuth } from 'angularfire2/auth'; import {

AngularFire - combine two FireStore collections with the same pushId items

青春壹個敷衍的年華 提交于 2019-12-04 15:16:54
I'm working on some project with AngularFire + FireStore. My Firestore model looks like this: Collection 1 key1 {some data} key2 {some data} Collection 2 key1 {other data} key2 {other data} Now I need to show list where I have some data from the first collection, and some data from another one. How to create such a list? It seems to be pointless to make two observables and then merge it. const collection = this.afStore.collection<any>(collectionName); return collection.snapshotChanges() .map(participants => { return participants.map(participant => { const data = participant.payload.doc.data();

Angular 6 and AngularFire2 RxJS Error

筅森魡賤 提交于 2019-12-04 12:03:57
I want to create a new Angular 6 App with AngularFire 2. Although I followed the tutorial, I get a version error. AngularFire2 Setup Tutorial: https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md Even though I only tried to use an Observable as seen in the tutorial I get the following error: ERROR in node_modules/angularfire2/angularfire2.d.ts(3,10): error TS2305: Module '"/Users/tarek/Documents/Development/web_app/apphoven-web/node_modules/rxjs/Subscription"' has no exported member 'Subscription'. node_modules/angularfire2/firestore/collection/changes.d.ts(3,10):

import { AngularFireDatabase, FirebaseListObservable } from “angularfire2/database”;

馋奶兔 提交于 2019-12-04 11:23:27
i had problem to import { AngularFireDatabase, FirebaseListObservable } from "angularfire2/database"; i imported AngularFireDatabase but FirebaseListObservable was under a red line after searching this post helped me resolve my problem Getting an error: "Has no exported member AngularFire, AuthProviders, AUthMethods, FirebaseListObservable" in AngularFire2? import { AngularFireDatabase, FirebaseListObservable } from "angularfire2/database-deprecated"; but when i compile i get and it cant help i dont know what to do where searching ect core.es5.js:1020 ERROR Error: Uncaught (in promise): Error:

Animation for newly rendered elements, but not on page load

耗尽温柔 提交于 2019-12-04 08:33:58
I'm subscribed to a Firebase real-time database so that when I submit something to it, it immediately renders in the view without any need for jQuery or ajax. I'd like to animate the rendering of such elements, so that when a new element is added to the DOM its div 's background-color is green and slowly fades away. What I don't want is for all div s of this class to perform this animation on load. I know how to do the former: @keyframes green-fade { 0% {background: rgb(173, 235, 173);} 100% {background: none;} } .post-div { animation: green-fade 5s ease-in 1; } But of course this animation

How to instantiate Firebase Cloud Messaging in Angular2

时光总嘲笑我的痴心妄想 提交于 2019-12-04 06:18:16
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 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 firebase.messaging() like this: import { Inject, Injectable } from "@angular/core"; import { FirebaseApp } from

angularfire2 auth state on page reload check user logged in

旧街凉风 提交于 2019-12-04 06:03:04
问题 I have an angular4 app using angularfire2 and I'm having difficulty in finding out how to check if a user is logged in on page load. I can login and logout without issue, and I've implemented a guard on the router to prevent unauthorised access. In an example I've found, the guard calls isLoggedIn in my auth service class, and checks if the user (AngularFireAuth) is not null. Since AngularFireAuth is of type Observable its never null so this doesn't work. How can I check if the user is logged

How to orderBy the closest distance from current location in AngularFire2?

只谈情不闲聊 提交于 2019-12-04 05:17:25
问题 I am using AngularFire2 library to query in firebase. In my firebase, i have data collection and in them, i have many rows with latitude and longitude like below: - data - 1404033346513076_1998422263740845 - location - latitude: 23.7907795 - longitude: 90.403898 - 1404033346513076_1998422263740888 - location - latitude: 23.9907795 - longitude: 91.403898 I have the latitude and longitude of my current location and i have a helper function which can determine the distance in meters between the

Get Key for object created after Push (Angular and Firebase)

a 夏天 提交于 2019-12-04 04:58:14
问题 I'm having problems understanding how to use Firebase. I wrote a function to push some data in my firebase database. I need to get the Key generated after I push the data into my db. This is my function postData(order: orderInfo) { let uid = firebase.auth().currentUser.uid; this.db.list('transactions').push({ currency: order.currency, total: order.total, rate: order.rate, uid: uid }); console.log(order.$key); this.db.list('transactionsPerUser').update(uid, order.$key); } When I push the data

How do I add client-side attributes to items in a FirebaseListObservable?

主宰稳场 提交于 2019-12-04 04:50:06
问题 I'm building a simple chat app backed by this Firebase Database structure: messages: { "-KTjL_oLrKOboa2su2zk": { name: "puf", text: "Look I'm smiling :-)" }, "-KTjNfaNem752ChFBcnC": { name: "puf", text: "And now I'm not smiling" } } I'm using Angular2 and AngularFire2 to generate the HTML. I have a simple list of messages from the Firebase Database in my controller: export class AppComponent { messages: FirebaseListObservable<any[]>; constructor(public af: AngularFire) { this.messages = af