import { AngularFireDatabase, FirebaseListObservable } from “angularfire2/database”;

馋奶兔 提交于 2019-12-04 11:23:27

In angularfire2": "^5.0.0-rc.2 you can't use FirebaseListObservable instead you will have to use

import { AngularFireDatabase } from 'angularfire2/database';

and use it like this

constructor(public af: AngularFireDatabase) {
  let restaurants = this.af.list('/path');
}

i got the answer after reading https://github.com/angular/angularfire2/blob/master/CHANGELOG.md 5.0.0-rc.0 (2017-10-03)

the -deprecated allows you to use the old database API

import { AngularFireDatabaseModule } from 'angularfire2/database-deprecated';

in the app.module.js and in your service you use

 import { AngularFireDatabase, FirebaseListObservable } from "angularfire2/database-deprecated";

thank you both of you, you helped me

You need to import the following and add it under your app.module.ts

import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';


@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AngularFireModule.initializeApp(firebaseConfig),
    AngularFireDatabaseModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!