AngularFIRE Property 'subscribe' does not exist on type 'AngularFireList<{}>'
export class AppComponent {
constructor(db : AngularFireDatabase){
db.list('/courses').valueChanges().subscribe()
}
}
In Angular firebase version 5.0 and above .subscribe is available after .valuechanges()
A simpler change would to be add valueChanges()
before .subscribe()
db.list('/Country/countries').valueChanges().subscribe(countries => {
this.countries = countries;
console.log(this.countries);
});
Starting in AngularFire 5.0 you'll want to use one of snapshotChanges()
, valueChanges<T>()
, stateChanges()
, or auditTrail()
. See the 5.0 migration guide.
Get started with the most basic, valueChanges()
:
export class AppComponent {
countries: Observable<Country[]>;
constructor(db: AngularFireDatabase ) {
this.countries = db.list('/Country/countries').valueChanges();
}
}