【问题标题】:Property 'list' does not exist on type 'Database'“数据库”类型上不存在属性“列表”
【发布时间】:2017-10-06 21:09:34
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    就当做吧,

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-16
      • 2022-01-26
      • 2018-10-15
      • 2018-01-23
      • 2023-03-10
      • 2021-01-09
      • 2018-11-17
      • 1970-01-01
      相关资源
      最近更新 更多