I have already installed firebase using npm and have imported it to appModule like the following
import {AngularFireModule} from "angularfire2";
import {AngularFirestoreModule} from "angularfire2/firestore";
These imports are successfully resolving in IntelliJ plus my node_modules directory has the angularfire2 and angularfire2/firestore folders, so I conclude that node install was successful.
used it in import like the following
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
HttpModule,
AppRoutingModule,
NgbModule.forRoot(),
AngularFireModule.initializeApp(firebaseConfig),
AngularFirestoreModule,
]
where firebaseConfig(copied and pasted from the console) I have tried keeping in the environment.ts as well as a variable in app.module.ts
After doing this when I try to use it in a service I get the following error
ERROR Error: Uncaught (in promise): FirebaseError: [code=invalid-argument]: "projectId" not provided in firebase.initializeApp.
FirebaseError: "projectId" not provided in firebase.initializeApp.
The service looks like the following
@Injectable()
export class ClientsService {
_clients: any;
constructor(private db:AngularFirestore) {
this._clients = this.db.collection('clients').valueChanges();
}
getClients(): Observable<any> {
this._clients = this.db.collection('clients').valueChanges();
return this._clients;
}
}
Here is the firebaseConfig var
var firebaseConfig = {
apiKey: "copied from firebase console",
projectId: "copied from firebase console",
messagingSenderId: "copied from firebase console"
}