Skip to content

Instantly share code, notes, and snippets.

@vanckruz
Created November 10, 2016 14:38
Show Gist options
  • Save vanckruz/c51cac8c707f3ecb6a92329490217c41 to your computer and use it in GitHub Desktop.
Save vanckruz/c51cac8c707f3ecb6a92329490217c41 to your computer and use it in GitHub Desktop.
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
}
}
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};
}
}
@vanckruz
Copy link
Author

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:
chatparams

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment