gpt4 book ai didi

Firebase 5 Angular 5 AngularFireList.snapshotChanges() 错误

转载 作者:行者123 更新时间:2023-12-04 22:27:31 34 4
gpt4 key购买 nike

当我尝试在 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)

我的服务和 Controller 类内容如下,

1) 名为“FirebaseService”的服务
customers: AngularFireList<any>;
getCustomers(){
this.customers = this.fire.list('users');
return this.customers;
}

2) Controller
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"] = element.key;
this.serviceProviders.push(y as ServiceProvider);
});
});

最佳答案

AngularFire 的最新版本需要 rxjs 6。如果您有尚未升级的依赖项,请升级 rxjs 并包含 rxjs-compat

关于Firebase 5 Angular 5 AngularFireList.snapshotChanges() 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50391354/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com