Created
November 10, 2016 14:38
-
-
Save vanckruz/c51cac8c707f3ecb6a92329490217c41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { NavController, NavParams, LoadingController } from 'ionic-angular'; | |
import { Storage } from '@ionic/storage'; | |
import * as localforage from "localforage"; | |
import { ProfileServices } from '../../providers/profile.services'; | |
@Component({ | |
template: '<div>test</div>', | |
providers: [ProfileServices] | |
}) | |
export class Profile { | |
public user: any; | |
public userProfile: any; | |
constructor(public navCtrl: NavController, public params: NavParams, public storage: Storage, private profile:ProfileServices){ | |
console.log("Passed params", params.data); //Object empty | |
console.log("Passed params", params.get("dto"));//undefined | |
console.log("Passed params", params.data.dto);//undefined | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, ViewChild } from '@angular/core'; | |
import { NavController, NavParams, LoadingController } from 'ionic-angular'; | |
import { IntroPage } from '../intro/intro'; | |
import { LoginPage } from '../login/login'; | |
import { Profile } from '../profile/profile'; | |
import { Privacy } from '../privacy/privacy'; | |
import { Settings } from '../settings/settings'; | |
import { Storage } from '@ionic/storage'; | |
import { ProfileServices } from '../../providers/profile.services'; | |
@Component({ | |
selector: 'page-footer', | |
templateUrl: 'footer.html', | |
providers: [ProfileServices] | |
}) | |
export class Footer { | |
//Tabss | |
tab1: any = Trips; | |
tab2: any = MyTrips; | |
tab3: any = Profile; | |
tab4: any = Settings; | |
//Parameters | |
profileParams: any; | |
constructor(public navCtrl: NavController, public params: NavParams, public storage: Storage, public loading:LoadingController, private profileService: ProfileServices){ | |
this.storage.set('user', JSON.stringify( this.params.get("user") ) ).then(() => { | |
console.log('Name has been set'); | |
}); | |
} | |
ionViewDidLoad() { | |
this.storage.get('user').then((user) => { | |
console.log('User footer'+user); | |
}); | |
} | |
getProfile(){ | |
this.profileParams = {dta:"jkjk",dto:"kkjm",nombre:9}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the documentation of ionic 2 show how to pass parameters to the page of a tab that works with an attribute in the contructor as shown here:
But not working, But does not work with events? , The idea is that when I do (ionSelect) in the tab update the value of the variable in [rootParams] but it does not.