angularfire2

localhost:3000/traceur SystemJS with AngularFire

余生长醉 提交于 2019-12-06 14:50:33
I picked the getting started with Angular2 tutorial format and only added in the angularfire2 part. I installed firebase and angularfire2 using the steps on the angularfire2 docs page Below is my systemjs.config.js /** * System configuration for Angular 2 samples * Adjust as necessary for your application needs. */ (function (global) { System.config({ paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { // our app is within the app folder app: 'app', // angular bundles '@angular/core': 'npm:@angular/core/bundles/core.umd.js'

How do you make a route guard with AngularFire2 wait for auth check

做~自己de王妃 提交于 2019-12-06 14:28:59
I want my auth guard to wait until I get the auth back from firebase before it reroutes me. Currently, the auth guard check inits first. I need to make it async in the canActivate, or only populate the canActivate after called. auth.guard.ts import { Injectable } from '@angular/core'; import { Router, CanActivate } from '@angular/router'; import { AuthService } from './auth.service'; @Injectable() export class AuthGuard implements CanActivate { constructor(private authService: AuthService) { console.log(this.authService.isAuthenticated); // returns false, doesn't async } canActivate() {

pass angularFire config imported in library using forRoot

依然范特西╮ 提交于 2019-12-06 14:26:11
问题 I use angularFire2 in a custom library @NgModule({ imports: [ CommonModule, AngularFireModule.initializeApp(firebaseConfig), AngularFirestoreModule ] }) export class CustomModule { static forRoot(firebaseConfig: FirebaseOptions): ModuleWithProviders { return { ... } } } the consumer library call CustomModule.forRoot({config...}) My question is how do I make the config data available in AngularFireModule.initializeApp(firebaseConfig) ? 回答1: I ran into this problem couple of weeks ago, what you

AngularFire - combine two FireStore collections with the same pushId items

懵懂的女人 提交于 2019-12-06 10:36:29
问题 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

Using pure Observable vs array (from subscribe)

眉间皱痕 提交于 2019-12-06 07:11:15
I was wondering about best practices regard using pure observable vs subscribe to an observable and use an array. option 1 - "pure observable" this.schools = this.angularFire.database.list('schools') and then in the HTML use async pipe (and rxjs operators for handling the data) option 2 - "subscribe to array" this.angularFire.database.list('schools').subscribe (response => this.schools=response) and then treat it as a normal array. As olsn pointed out in the comments, it is always more practical to use the async pipe to handle this situation. However, if you choose to use the manual subscribe

Angular 6 and AngularFire2 RxJS Error

这一生的挚爱 提交于 2019-12-06 06:34:54
问题 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

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

梦想的初衷 提交于 2019-12-06 05:22:20
问题 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

Display loading while using Observable with Async pipe in template

故事扮演 提交于 2019-12-06 05:00:34
问题 Situation: I am using FirebaseObjectObservable to populate my Ionic 2 (rc0) template. Template code: <ion-card-content> <p>{{(course | async)?.description}}</p> <br> <h2>Learning Objectives</h2> <ul> <li *ngFor = "let objective of (course | async)?.objectives">{{objective.text}}</li> </ul> <h2>Takeaway</h2> <ul> <li *ngFor = "let takeaway of (course | async)?.takeaways">{{takeaway.text}}</li> </ul> </ion-card-content> TS code: this.course = this.af.database.object('/bbwLocations/courses/' +

FCM getToken() doesn't return anything

♀尐吖头ヾ 提交于 2019-12-06 05:00:18
I'm trying to use Firebase Cloud Messaging with Angular2 but it's like they don't want us to do that @Google. I've been following this and this to be able to stop errors. I'm now facing the following problem: Why does messaging.getToken() returns nothing? No error, no token in the console, nothing. Any help is more than welcome. Thank you. EDIT I've updated the code bellow with my try using onTokenRefresh() . It does not change anything. I feel like it comes from the fact that I'm not really plugged to my firebase files. Anybody have been able to make FCM with Angular2 and AngularFire2? import

Mock AngularFireAuth When Unit Testing an Angular Service

柔情痞子 提交于 2019-12-06 00:01:48
I have an authService which when instantiated subscribes to AngularFireAuth 's Observable authState and sets the services' internal (private) property authState . So I can unit test authService I highjack the services' internal authState with Reflect.get/set in my test specs so I can control its value. The problem is of course authService is still subscribing to AngularFireAuth 's Observable authState during its instantiation and I don't want, nor need it to. I presume I need to mock out AngularFireAuth which fakes a subscription and doesn't actually communicate to Firebase? New to unit tests