Assign component from string

Hi, I want to get a list navigation from server and navigate to them from ionic. So I need to something like this:

 this.pages = [
      { title: 'login', component: someStringFromServer['LoginPage'] },
      { title: 'list', component: someStringFromServer['ListPage']  },
      // Some stuff object
openPage(page) {

what I should do for this?

I think this is a bad idea, because it makes your app nondeterministic and far harder to test, maintain, and read.

That being said, if you absolutely insist, you can either use lazy page loading (in which case you navigate via strings anyway) or build a string-to-page-component map in your app.

1 Like

So, I used string to component map and it work :slight_smile: tnQ