I want to use firebase and angularfire2 in my app, first of all, I installed them, and for the declarations:
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, imports:
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule
in the component where want to get my data:
import { AngularFirestore } from 'angularfire2/firestore';
until this moment I have not an error, but when I want to declare my variable in the constructor to use it:
constructor(private trainingService: TrainingService, private
db:AngularFirestore) { }
I have an 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 don't know why?
thanks for your help
This was my solution:
I had same problem but i solved it. You can follow my work. This is a example for ionic.
Install rxjs
import rxjs-compact to file
https://stackoverflow.com/a/50447449/6567753