How to set an array of pages in a function and return to a variable, NAVCTRL IONIC

Asked

Viewed 29 times

1

I’m making an application in which the app component has a side menu that uses a Let to fetch the array of pages, however I cannot access them from my previous, not getting the return.

//I want to separate the manipulation of the app in two, so I’m checking if the user is admin or common

definePage() {

if(this.getBoolPages() === true) {

  this.pages = [
    { title: 'Menu', component: MenuPage },
    { title: 'menu', component: MenuPage }
  ];

} else {

  this.pages = [
    { title: 'Xisde', component: MenuPage }
  ];

}

return (this.pages);

}

  getBoolPages() {

return this.pagAcessoSup;

}

In the app.component.ts I’m trying to get it like this:

pages: Array<{title: string, component: any}>;

constructor(
public platform: Platform, 
public statusBar: StatusBar,
private authProvider:AuthProvider, 
public splashScreen: SplashScreen) {

this.pages = authProvider.definePage();

this.initializeApp();

}

However, when it is more than one item, it simply receives nothing.

How to solve this?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.