Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49259

Push from app.component

$
0
0

@SannNL wrote:

I’m trying to push my app to a page from app.component.ts. I used this tutorial in the docs: https://ionicframework.com/docs/api/navigation/NavController/
Sadly the app doesn’t get pushed to a different page.

app.html

<ion-nav #myNav [root]="rootPage"></ion-nav>

<ion-tabs class="tabs-icon-top">
    <ion-tab tabTitle="Nieuws" tabIcon="custom-news" [root]="tab1"></ion-tab>
    <ion-tab tabTitle="Wedstrijden" tabIcon="custom-games" [root]="tab2"></ion-tab>
    <ion-tab tabTitle="Selectie" tabIcon="custom-players" [root]="tab3"></ion-tab>
    <ion-tab tabTitle="Meer" tabIcon="custom-more" [root]="tab4"></ion-tab>
</ion-tabs>


app.component

import {Component, ViewChild} from '@angular/core';
import {NavController, Platform} from 'ionic-angular';
import {OneSignal} from '@ionic-native/onesignal';

// Pages
import {News} from '../pages/news/news';
import {NewsDetail} from '../pages/news/news-detail';
import {Players} from '../pages/players/players';

@Component({
    templateUrl: 'app.html'
})

export class MyApp {
    @ViewChild('myNav') nav: NavController;

    constructor(public platform: Platform) {
        platform.ready().then(() => {
            this.nav.push(Players);
});
}
    ngOnInit(){
        this.nav.push(Players);
    }
}

It might have something to do with the tabs since they also use [root]?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49259

Trending Articles