我正在尝试关注 Angular2 Firebase 应用tutorial并且我遇到了这个错误。似乎列表方法在最新版本中不再存在,我无法得到任何修复此错误的线索。
firebase.service.ts :
import { Injectable } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable } from "angularfire2/database-deprecated";
@Injectable()
export class FirebaseService {
listings: FirebaseListObservable<any[]>;
constructor(private af:AngularFireDatabase) { }
getListings(){
this.listings=this.af.database.list('/listings') as FirebaseListObservable<Listing[]>
return this.listings;
}
}
interface Listing{
//declarations
}
答案 0 :(得分:1)
只需将其用作,
getListings(){
this.listings=this.af.list('/listings') as FirebaseListObservable<Listing[]>
return this.listings;
}