this.db.object('/users/'+user.uid).update({
name:user.displayName,email:user.email
});
}
遇到此错误:
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
答案 0 :(得分:0)
转到tsconfig.json,
将目标从es2015更改为es5。
这对我有用。
我认为当您使用AngularFire数据库方法时,编译器仍然存在问题,我不能100%地确定原因,但是更改目标可以立即解决问题,并且我的用户字段很容易在数据库中创建
答案 1 :(得分:0)
TSCONFIG.JSON
中的 TARGET 从 es2015 更改为 es5
然后用ng serve
重新编译