2

I'm following a tutorial that was made a year ago and as i follow, i come across a couple of code that seems to be outdated. I 've searched a found a couple of solutions but it sadly doesn't solve mine. Is there therefore a newer way of writing the following code?

import {AngularFireDatabase, FirebaseListObservable} from 'angularfire2/database';
import { AngularFireAuth } from "angularfire2/auth";
import { Observable } from "rxjs/Observable";

this is the error it is printing out.

ERROR in node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'. src/app/chat-form/chat-form.component.ts(16,15): error TS2339: Property 'sendMessage' does not exist on type 'ChatService'. src/app/services/chat.service.ts(2,30): error TS2305: Module '"C:/Users/Gabriel/stack/School/HVA/JAAR 2/YOUTUBE TYPESCRIPT TUTORIAL/MyAngularApplication/We-chat/node_modules/angularfire2/database/index"' has no exported member 'FirebaseListObservable'. src/app/services/chat.service.ts(4,10): error TS2305: Module '"C:/Users/Gabriel/stack/School/HVA/JAAR 2/YOUTUBE TYPESCRIPT TUTORIAL/MyAngularApplication/We-chat/node_modules/rxjs/Observable"' has no exported member 'Observable'.

2
  • i think version 2, this was my command execution npm install -- save firebase angularfire2 Commented Dec 28, 2018 at 12:12
  • check my answer below, no it is called angularfire2.. has nothing to do with the version github.com/angular/angularfire2/blob/master/CHANGELOG.md Commented Dec 28, 2018 at 12:14

2 Answers 2

1

According to this:

Module '"C:/Users/Gabriel/stack/School/HVA/JAAR 2/YOUTUBE TYPESCRIPT TUTORIAL/MyAngularApplication/We-chat/node_modules/angularfire2/database/index"' has no exported member 'FirebaseListObservable'

It seems you are using angularFire 5.0, then you need to check the following, FirebaseListObservable was removed from the package and deprecated. You need to do the following:

import { AngularFireDatabase } from 'angularfire2/database';

constructor(afDb : AngularFireDatabase) 
{
  afDb.list<Item>('items').valueChanges().subscribe(console.log);
}

If you still want to use the FirebaseListObservable then you need to import it from 'angularfire2/database-deprecated'

Check here to see all the classes in the package angularfire2/database-depracted:

https://github.com/angular/angularfire2/tree/master/src/database-deprecated

Sign up to request clarification or add additional context in comments.

3 Comments

i just found out that its been replaced with this AngularFireList github.com/angular/angularfire2/blob/master/docs/…
yes this is the link that I wrote in my answer.. did you try it?
i tried it and it worked, very very useful information, thanks!1
0

yes u are probably using angular 5 ,it is being removed and replaced with AngularFireList try replacing FirebaseListObservable with AngularFireList.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.