Can not have access to multiple Google Firestore DB in Angular 6 application with angularfire2

前端 未结 1 1664
灰色年华
灰色年华 2021-01-03 14:39

I try to have access to multiple Google Firestore DB from my Angular 6 application through angularfire2 package.

I initialized multiple instance of AngularFireModule

相关标签:
1条回答
  • 2021-01-03 14:59

    After some searches around, the following answer could help a lot: angular2firebase - multiple instances using Angular 6

    looks like creating providers for each instance can be a good idea

    ...
    { provide: AngularfirestoreCoolStoreService, deps: [PLATFORM_ID, NgZone], useFactory: AngularfirestoreCoolStoreFactory },
    { provide: AngularfirestorePerfectStoreService, deps: [PLATFORM_ID, NgZone], useFactory: AngularfirestorePerfectStoreFactory }
    ...

    I created a stalkblitz which shows how it works: https://stackblitz.com/edit/angular-or2ehb

    0 讨论(0)
提交回复
热议问题