问题
this.db.object('/users/'+user.uid).update({
name:user.displayName,email:user.email
});
}
getting this error :
core.js:9110 ERROR TypeError: Class constructor Observable cannot be invoked without 'new' at new FirebaseObjectObservable (firebase_object_observable.js:16) at FirebaseObjectFactory (firebase_object_factory.js:7) at AngularFireDatabase.push../node_modules/angularfire2/database/database.js.AngularFireDatabase.object (database.js:18) at UserService.save (user.service.ts:20) at SafeSubscriber._next (app.component.ts:23) at SafeSubscriber.__tryOrUnsub (Subscriber.js:185) at SafeSubscriber.next (Subscriber.js:124) at Subscriber._next (Subscriber.js:72) at Subscriber.next (Subscriber.js:49) at Notification.observe (Notification.js:20) defaultErrorLogger @ core.js:9110
回答1:
Go to tsconfig.json,
Change the target from es2015 to es5.
This worked for me.
I think the compiler is still having issues when you use the AngularFire Database methods, I am not 100% sure of the cause, but changing the target solved the issue immediately and my user field was easily created in the DataBase
回答2:
change TARGET in TSCONFIG.JSON
from es2015 to es5
and then recompile with ng serve
来源:https://stackoverflow.com/questions/57029413/angular-7typeerror-class-constructor-observable-cannot-be-invoked-without-new