Navigate from side menu to another pages


#1

I’m trying to navigate from the side menu to other pages but didn’t work
every time I got pushSettingsPage is not defined
where it shouled load the function from ?
app.html


main.ts


#2

Hey @a7mdFo2ad, try writing the pushsettingspage function in you component.ts file


#3

can’t inject nav controller in the constructor !


#4

For nav, do like this:

import { Nav } from 'ionic-angular';

export class YourApp {
  @ViewChild(Nav) nav: Nav; //no need to inject in constructor
 
  openPage() {
      this.nav.push(yourPage);
  }

I hope this will help.


#5

thank you …worked but still side menu opened


#6

Sorry, didn’t get what you are saying. Can you elaborate a little?


#7

I hope this will help


#8

worked when i try to navigate to another page but side menu still opened
and it should close after open another page


#9

Gotcha. Just add menuClose attribute where you are calling the click function. Just like this:

<ion-item menuClose class="menu-items" onclick="pushSettingsPage()">

Just add menuClose and you are good to go. Let me know if it helps!


#10

thank you man :slight_smile:


#11

Np buddy. Glad to help :slight_smile: