财产'列表'类型'数据库'上不存在

时间:2017-10-06 11:45:38

标签: angular firebase firebase-realtime-database firebase-authentication

我正在尝试关注 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
}

1 个答案:

答案 0 :(得分:1)

只需将其用作,

getListings(){
   this.listings=this.af.list('/listings') as FirebaseListObservable<Listing[]>
   return this.listings;    
}