Skip to content

Document properly how to use multiple Firebase projects in one app #1305

Closed
@swftvsn

Description

@swftvsn

There's a lenghty discussion about this in #1240, and one stackblitz example how to do it, thanks for that!

The comments keep piling, so it seems this is still a source of frustration to people.

The documentation should include examples how to...

  • Configure 2 or more projects (for an example projects a, b and c)
  • inject realtime database or firestore pointing to project b to Angular component
  • inject realtime database or firestore pointing to project c to Angular service (annotated with @Injectable())
  • inject two instances of realtime database or firestore pointing to project b and c configuration to Angular component
  • inject two instances of realtime database or firestore pointing to project b and c configuration to Angular service (annotated with @Injectable())

So, essentially how to inject like this:

import { Injectable } from '@angular/core'
import { AngularFireDatabase } from 'angularfire2/database'

@Injectable()
export class MyService {

  constructor(
    private storeAppDb: AngularFireDatabase,
    private invoicingAppDb: AngularFireDatabase
  ) {
  }

}

I don't think Angular supports injection scheme like that, but a blueprint how to achieve the same would be nice. (If I can choose which one to inject, then I can make two wrapper services, that I can inject..)

It would be nice though to be just able to say:

import { Injectable } from '@angular/core'

@Injectable()
export class MyService {

  constructor(
    private angularfire: AngularFire
  ) {
    const firestore1 = angularfire.firestore('conf1')
    const firestore2 = angularfire.firestore('conf2')
  }

}

which would return the angularfireified firestore etc. services.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions