我正在尝试连接到我的Firebase数据库以访问用户集合,但是不知何故它不起作用。我认为该错误与返回类型有关。
从Firebase获取用户集合的代码:
getAllUsers(): AngularFireList<any[]> {
return this.db.list('users');
}
从服务获取用户数据的代码:
this.userService.getAllUsers().snapshotChanges().subscribe(data => {
console.log(data);
});
在控制台中出现以下错误:
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:91)
at RefCountSubscriber.Subscriber._next (Subscriber.js:127)
at RefCountSubscriber.Subscriber.next (Subscriber.js:91)
at Subject.next (Subject.js:56)
at ConnectableSubscriber.Subscriber._next (Subscriber.js:127)
at ConnectableSubscriber.Subscriber.next (Subscriber.js:91)
at Notification.observe (Notification.js:32)
at AsyncAction.DelaySubscriber.dispatch (delay.js:91)