angular firestore configuration.

1,305 views
Skip to first unread message

Joseph Dickinson

unread,
Feb 10, 2019, 11:21:30 PM2/10/19
to Firebase Google Group
so far I have this: module
import { AngularFirestoreModule, AngularFirestore} from '@angular/fire/firestore';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpClientModule,
    AngularFireModule.initializeApp(environment.firebase),
    AngularFirestoreModule
  ],
  providers: [AngularFirestore],
  bootstrap: [AppComponent]
})
export class AppModule { }
Enter code here...




and for the app

import { Component, OnInit } from '@angular/core';
import { EveSystem, Adm, EveHome } from './models/model';
import {AngularFireStorage} from '@angular/fire/storage';


@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
constructor(private db: AngularFireStorage ) {
// this.db = this.adb.storage.app.firestore();
}



I am getting this error:
ERROR Error: StaticInjectorError(AppModule)[AppComponent -> AngularFireStorage]: 
  StaticInjectorError(Platform: core)[AppComponent -> AngularFireStorage]: 
    NullInjectorError: No provider for AngularFireStorage!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (http://localhost:4200/vendor.js:34167:19)
    at tryResolveToken (http://localhost:4200/vendor.js:34349:16)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (http://localhost:4200/vendor.js:34246:20)
    at tryResolveToken (http://localhost:4200/vendor.js:34349:16)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (http://localhost:4200/vendor.js:34246:20)
    at resolveNgModuleDep (http://localhost:4200/vendor.js:41474:29)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (http://localhost:4200/vendor.js:42162:16)



Can anyone see what I may have done wrong?

Kato Richardson

unread,
Feb 11, 2019, 6:49:03 PM2/11/19
to Firebase Google Group
Hi Joseph, 

"No provider" means that you didn't inject AngularFireStorageModule at the module level, generally by adding it to `providers` in your app.module.ts. See steps 6 and 7 here: https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md#6-setup-individual-ngmodules

☼, Kato



--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7974a66a-2e6d-4263-bd5f-d6e6f09c4c31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

John Carroll

unread,
Feb 12, 2019, 2:46:12 PM2/12/19
to Firebase Google Group
To expand on Kato's response, you imported `AngularFirestoreModule` in your `AppModule`, but in your `AppComponent` you've injected `AngularFireStorage`. FireStorage is distinct from Firestore. If you want to use FireStorage, you'll need to import the AngularFireStorageModule in your AppModule (I'm guessing at the name).

--John
Reply all
Reply to author
Forward
0 new messages