2
我正在开发一个Ionic2应用程序,我使用的是承诺。在一个打字稿I类已经创建了这个方法承诺的空对象Angular2
tapOnRegistrati() {
this.authService.userRegistration(this.email,this.password).then(function(user){
this.user = this.af.database.object('/users/' + user.uid);
this.user.set({ name: this.name, lastname: this.lastname});
}).catch(function(error: any) {
});
}
但是当执行then
块this
的参考是null
,所以不能使用我打字稿类的任何对象/属性。为什么?