小编Lak*_*hne的帖子

Firebase 5 Angular 5 AngularFireList.snapshotChanges()错误

当我尝试在Angular 5/Firebase5应用程序中订阅AngularFireList时出现以下错误.

zone.js:192 Uncaught TypeError: Object(...) is not a function
    at SwitchMapSubscriber.eval [as project] (changes.js:7)
    at SwitchMapSubscriber._next (switchMap.js:91)
    at SwitchMapSubscriber.Subscriber.next (Subscriber.js:95)
    at RefCountSubscriber.Subscriber._next (Subscriber.js:131)
    at RefCountSubscriber.Subscriber.next (Subscriber.js:95)
    at Subject.next (Subject.js:56)
    at ConnectableSubscriber.Subscriber._next (Subscriber.js:131)
    at ConnectableSubscriber.Subscriber.next (Subscriber.js:95)
    at Notification.observe (Notification.js:32)
    at AsyncAction.DelaySubscriber.dispatch (delay.js:91)
Run Code Online (Sandbox Code Playgroud)

我的服务和控制器类内容如下,

1)名为'FirebaseService'的服务

customers: AngularFireList<any>;
getCustomers(){
    this.customers = this.fire.list('users');
    return this.customers;
  }
Run Code Online (Sandbox Code Playgroud)

2)控制器

constructor(private firebase: FirebaseService) { }

serviceProviders: ServiceProvider[];
var x = this.firebase.getServiceProviders();
    x.snapshotChanges().subscribe(item => {
      this.serviceProviders = [];      
      item.forEach(element => {
        var y = element.payload.toJSON();
        y["$key"] = …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-realtime-database angularfire2 angular5

4
推荐指数
1
解决办法
2281
查看次数