Когда я пытаюсь подписать AngularFireList в приложении Angular 5 / Firebase5, выдавая следующую ошибку:
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)
Содержимое класса My Service и Controller выглядит следующим образом:
1) Service named 'FirebaseService '
customers: AngularFireList<any>;
getCustomers(){
this.customers = this.fire.list('users');
return this.customers;
}
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"] = element.key;
this.serviceProviders.push(y as ServiceProvider);
});
});