i try to direct the user directly to a new component, if the user is already signed in. Unfortunately i receive always the error "goPersonalData is not a function". Maybe someone could help me:
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']);
}
}