Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use angularfire2 with Angular 6?

I'm trying to add firebase support to my Angular 6 app but when adding angularfire2

npm install angularfire2 firebase

I get a lot of warning saying I must use Angular 5. For example

npm WARN [email protected] requires a peer of @angular/core@^5.0.0 but none is installed. You must install peer dependencies yourself.

Is it possible to use angularfire2 with Angular 6 today?

I get this error when compiling:

ERROR in node_modules/angularfire2/angularfire2.d.ts(3,10): error TS2305: Module '"/home/rrr/Projects/ng6test/node_modules/rxjs/Subscription"' has no exported member 'Subscription'.
node_modules/angularfire2/firebase.app.module.d.ts(10,22): error TS2720: Class 'FirebaseApp' incorrectly implements class 'FirebaseApp'. Did you mean to extend 'FirebaseApp' and inherit its members as a subclass?
  Property 'automaticDataCollectionEnabled' is missing in type 'FirebaseApp'.
node_modules/rxjs/Subscription.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subscription'.

I tried to install rxjs-compat but after that I get another warning

ERROR in node_modules/angularfire2/firebase.app.module.d.ts(10,22): error TS2720: Class 'FirebaseApp' incorrectly implements class 'FirebaseApp'. Did you mean to extend 'FirebaseApp' and inherit its members as a subclass?
  Property 'automaticDataCollectionEnabled' is missing in type 'FirebaseApp'.
like image 864
krk999 Avatar asked Apr 28 '18 11:04

krk999


2 Answers

I have tried and I cannot make Angular 6 work with any version of AngularFire2 (latest version: 5.0.0-rc.7.2-next). I guess we need to wait for next major version of AngularFire2.

Update:
A temporary solution is to install rxjs-compat.
npm install --save rxjs-compat

like image 163
6324 Avatar answered Nov 05 '22 16:11

6324


try:

npm install firebase angularfire2@next --save

Fixed in pre-released version:

angularfire2@next
like image 33
WebDevDaniel Avatar answered Nov 05 '22 14:11

WebDevDaniel