It is possible to use both LazyLoading and DeepLinks?


#1

I like the Lazy Loading but certain modules do not work with it.
eg: Videogular, Dragula ( to my experience )

Is there a way to use lazy loading for some pages and deep links with others?

I have LazyLoading working with the .module.ts files and @IonicPage decorators.
Now I want to load some pages without LazyLoading so that their included modules will work.

Using the following works but Lazy Loaded pages now do not.

IonicModule.forRoot(MyApp,
      {}, {
        links: [
          { component: HomePage, name: 'HomePage', segment: 'home' },
          { component: UnitPage, name: 'Schedule', segment: 'unit/:id' },
        ]
      }),

Removing that makes Lazy Loaded pages work but DeepLinked pages do not show the segment id in the url.
I have tried this method: ref:

this.deeplinks.routeWithNavController(this.nav, {
        '/home/': HomePage,
        '/unit/:id': UnitPage,
      }).subscribe((match) => {
          console.log('Successfully matched route', match);
        }, (nomatch) => {
          console.error('Got a deeplink that didn\'t match', nomatch);
        });

This enabled me to utilize Dragula, for example.

But, the url does not display the segment id.


Has anyone actually deployed an Ionic app to the web?
#2

Push this question it is really relavent.


#3

Yes it’s possible to have both lazyLoading and deeplinks. Remove the 3rd parameter (deeplinksConfig) in your call to IonicModule.forRoot as the IonicPage decorator automatically sets the deeplinksConfig during build.