-
-
Save aaronksaunders/74909d9be4aa78882e5b to your computer and use it in GitHub Desktop.
passing params
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 {App, Platform } from 'ionic-angular'; | |
import {RouteConfig, Location} from 'angular2/router'; | |
import {HomePage} from './pages/home/home'; | |
import {TabsPage} from './pages/tabs/tabs'; | |
// https://angular.io/docs/ts/latest/api/core/Type-interface.html | |
import {Type} from 'angular2/core'; | |
@App({ | |
config: {} // http://ionicframework.com/docs/v2/api/config/Config/ | |
}) | |
@RouteConfig([ | |
{ path: '/', component: HomePage, as: 'HomePage' }, | |
{ path: '/tabs', component: TabsPage, as: 'Tabs' }, | |
]) | |
export class MyApp {} |
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
<ion-navbar *navbar> | |
<ion-title> | |
HOME PAGE | |
</ion-title> | |
</ion-navbar> | |
<ion-content class="home"> | |
<button (click)="clicked($event)" >HELP</button> | |
</ion-content> |
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 {Page, NavParams, NavController} from 'ionic-angular'; | |
import {TabsPage} from '../tabs/tabs'; | |
@Page({ | |
templateUrl: 'build/pages/home/home.html' | |
}) | |
export class HomePage { | |
// this tells the tabs component which Pages | |
// should be each tab's root Page | |
constructor( public nav:NavController) { | |
} | |
// click to goto main tab page and pass params | |
clicked(event) { | |
event.preventDefault(); | |
this.nav.push(TabsPage, { user:"Aaron"}); | |
} | |
} |
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
<ion-tabs > | |
<ion-tab [root]="tab1Root" [rootParams]="tab1Params" tabTitle="Tab 1" tabIcon="pulse"></ion-tab> | |
<ion-tab [root]="tab2Root" tabTitle="Tab 2" tabIcon="chatbubbles"></ion-tab> | |
<ion-tab [root]="tab3Root" tabTitle="Tab 3" tabIcon="cog"></ion-tab> | |
</ion-tabs> |
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 {Page, NavParams} from 'ionic-angular'; | |
import {Page1} from '../page1/page1'; | |
import {Page2} from '../page2/page2'; | |
import {Page3} from '../page3/page3'; | |
@Page({ | |
templateUrl: 'build/pages/tabs/tabs.html' | |
}) | |
export class TabsPage { | |
// this tells the tabs component which Pages | |
// should be each tab's root Page | |
tab1Root: any = Page1; | |
tab2Root: any = Page2; | |
tab3Root: any = Page3; | |
constructor(private params: NavParams) { | |
// got params when page was opened... set on the desired tab | |
this.tab1Params = params; | |
console.log(params) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment