hello,
i have two pages:
facebook login and home page.
the facebook login works fine but when i want to pass data(the facebook details object) to homepage i get undefined value…
if i’m using in the data in same page of login it works fine.
i tried to pass other data(just string i declare and it works fine)
my facebooklogin function
facebookLogin(){
Facebook.login([‘email’]).then( (response) => {
let facebookCredential = firebase.auth.FacebookAuthProvider
.credential(response.authResponse.accessToken);firebase.auth().signInWithCredential(facebookCredential) .then((success) => { alert("sign in"); console.log("Firebase success: " + JSON.stringify(success)); this.userProfile = success; this.nav.push(HomePage,{ user:this.userProfile }); }) .catch((error) => { console.log("Firebase failure: " + JSON.stringify(error)); });
when i print this line
console.log("Firebase success: " + JSON.stringify(success));
i see all facebook data
but when i pass it to other component to homepage, ithe user profile variable is undefined,means nothing pass
import { Component } from ‘@angular/core’;
import { NavController,NavParams } from ‘ionic-angular’;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
userProfile: any=null;
constructor(public navCtrl: NavController,public navParams: NavParams) {
this.userProfile = this.navParams.get(‘user’);
console.log( this.userProfile);
}}