Ionic 3 load Components from Text

Hi,

i want to make a Settings to set the Startpage. I want to save the String of the Site Component. Is it possible to get the Component from the Name? Or can i save the Component to the Storage?

Thank You,
Daniel

This depends on whether you’re using lazy page loading. If so, then very easy. Just store the class name string and pass it to your interactions with the navigation system. If not, I think you are going to have to build up your own map along the lines of:

pages = {
  'PageA': PageA,
  'PageB': PageB,
  'PageC': PageC,
};

rootPage: any;

constructor(storage: Storage) {
  storage.get('landingPage').then(lp => this.rootPage = this.pages[lp]);
}

i use Lazy Loading.
Awesome Thank You. It is working.