如果用户已经登录,我会尝试将用户直接定向到新组件。不幸的是,我总是收到错误消息“ goPersonalData不是函数”。也许有人可以帮助我:
ngOnInit() {
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
this.goPersonalData();
} else {
}
});
}
onSubmit(form: NgForm) {
const email = form.value.email;
const password = form.value.password;
this.authService.login(email, password);
}
goPersonalData() {
this.router.navigate(['/personalData']);
}
}