I want to use Firebase and angularfire2 in my app, the first thing I did was install it with:
npm install firebase@latest angularfire2@latest --save
Then I added the statements:
In environment.ts
export const environment = {
production: false,
firebase: {
apiKey: 'sfsdfdsff',
authDomain: 'sfsdfdf',
databaseURL: 'https://ng-sfsdfsf.firebaseio.com',
projectId: 'ng-fitnesssfsdfdsf',
storageBucket: 'ng-fsdfsdfsfdecff5.appspot.com',
messagingSenderId: '21331323'
}
In app.module.ts , the imports:
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule
In the component where I want to obtain my data:
import { AngularFirestore } from 'angularfire2/firestore';
At this moment I do not have any errors, but when I try to declare the variable in the constructor to use it:
constructor(private trainingService: TrainingService, private
db:AngularFirestore) { }
I get the following error:
ERROR TypeError: Object(...) is not a function
at eval (firestore.js:28)
at ZoneDelegate.invoke (zone.js:388)
at Zone.run (zone.js:138)
In my package.json :
"angularfire2": "^5.0.0-rc.8.0",
"core-js": "^2.4.1",
"firebase": "^5.0.2",
And I do not know why.
Could someone help me?