Beta 8 - how to use nav in root component @ViewChild (JS)


#1

Currently updated my latest project to Beta 8 before shipping but ran into small issue. I can’t seem to figure out how to use the navController in the root component. I understand the reasons why it cant be injected, but it seems the docs are in TS (http://ionicframework.com/docs/v2/components/#navigation), and my project is in JS, and I can’t figure out how, or where to place the new code.

Beta 7, I did the following:

@App({
    templateUrl: 'build/app.html',
    providers: [APIRestInterface, etc...]
    queries: {
        nav: new ViewChild('content')
    }
})

I’m not sure how to do this since the config/bootstrapping methods have changed.


#2

Actually, never mind. I noticed that the ionic-conference app had been updated to Beta 8, and it’s clear that the queries remain part of the component

i.e. In my case:

@Component({
    templateUrl: 'build/app.html',
    queries: {
        nav: new ViewChild('content')
    }
})

All is well!


#3

@App change to @Component, chech the link of @pjhartin


#4

@arsene123 It was actually myself that replied to my own message, but thanks anyway. The issue wasn’t @App/@Component. It was that I was unsure where the assignment of nav would take place in a non-TS project.


#5

@ pjhartin, ah ok. this is mentioned in the readme beta@8