this.navCtrl.push() is not working even though the alerts are. If I put alerts below the nav.push they don’t show. Why is this like every thing works par this.navCtrl.push(‘Page’);
return this.facebook.login(['email'])
.then( response => {
const facebookCredential = firebase.auth.FacebookAuthProvider
.credential(response.authResponse.accessToken);
firebase.auth().signInWithCredential(facebookCredential)
.then( success => {
console.log("Firebase success: " + JSON.stringify(success));
firebase
.database()
.ref(`/userProfile/${success.uid}/email`)
.set(success.email);
console.log("Firebase success: " + JSON.stringify(success));
firebase.auth().onAuthStateChanged(user => {
if (user) {
alert("his")
firebase.database().ref(`/userProfile/${user.uid}/userType`).once("value").then(function (snapshot) {
alert(snapshot.val())
if (snapshot.val()!= null){
alert("error1")
this.navCtrl.push('Page');
}
else{
alert("error2")
this.navCtrl.push('Page2');
}})}})```