AngularFIRE Property 'subscribe' does not exist on type 'AngularFireList<{}>'

后端 未结 5 1641
名媛妹妹
名媛妹妹 2021-02-06 03:18

I\'m following this tutorial about how to connect angular with firebase database. But in minute 17:30 I\'m getting this error:

Property \'subscribe\' does not ex

5条回答
  •  天涯浪人
    2021-02-06 03:38

    Starting in AngularFire 5.0 you'll want to use one of snapshotChanges(), valueChanges(), stateChanges(), or auditTrail(). See the 5.0 migration guide.

    Get started with the most basic, valueChanges():

    export class AppComponent {
      countries: Observable;
      constructor(db: AngularFireDatabase ) {
        this.countries = db.list('/Country/countries').valueChanges();
      }
    }
    

提交回复
热议问题