In this code I do not understand why the forward if is ignored because although there is an error in the authentication, it always goes to the main page regardless of whether the variable err is true.
entrar()
{
var err=false;
firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(function(result){
console.log("exito");
err=false
})
.catch(function(error) {
console.log("error");
console.log(error.code);
console.log(error.message);
err=true;
});
if (err){
console.log("error");}
else{
this.navCtrl.push(HomePage);}
}
Someone explains to me that I am doing wrong.