What is #content in <ion-nav id="nav" [root]="rootPage" #content swipeBackEnabled="false"></ion-nav> mean?


#1

I was reading tutorial of ionic 2 and until this page:

<ion-menu [content]="content">
....
</ion-menu>

<ion-nav id="nav" [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>

what is #content mean? does it mean I name this ion-nav as name “content”?


#2

Need help guys plz help with this , facing the same problem…


#3

Here’s the concept: #content Here we are creating just a local reference of the nav controller shown by directive < ion-nav> , now this local reference can be later used in the app.component.ts(main loading component of your app) like this: @ViewChild(‘content’) nav

now we have this instance nav which we can use to push or pop pages on the nav-controller…
Do ping in case more info is needed on the same… :slight_smile:


#4

Navigating from the Root Component
What if you want to control navigation from your root app component? You can’t inject NavController because any components that are navigation controllers are children of the root component so they aren’t available to be injected.

By adding a reference variable to the ion-nav, you can use @ViewChild to get an instance of the Nav component, which is a navigation controller (it extends NavController):