Ionic 3 deep-linking and lazy-loading at the same time

本小妞迷上赌 提交于 2019-12-22 10:39:46

问题


According to what I've read in the documentation and forums, you enable deep-linking via : forRoot(appRoot, config, deepLinkConfig)

@ngModule({
  ..
  IonicModule.forRoot(MyApp, {}, {
    links:[{ component: ContactPage, name: "contact", segment: "contact"},
           { component: HelloPage, name: "hello", segment: "hello" }
          ]
  })
  ...
}) ...

This leads to adding ContactPage and HelloPage to declarations and entryComponents arrays within @ngModule, which would not be lazy-loaded.

So, this leads to the question, can you substitute strings, doing away with the imports and double array declaration, and have this?

@ngModule({
  ..
  IonicModule.forRoot(MyApp, {}, {
    links:[{ component: 'ContactPage', name: "contact", segment: "contact"},
           { component: 'HelloPage', name: "hello", segment: "hello" }
          ]
  })
  ...
}) ...

and achieve lazy-loading at the same time?

Update: Tried with a single Tabs page. I'm guessing it's not working ATM.


回答1:


I'm seeing same error in 2018. It seems deep links and lazy loading don't play well together. I propose to use the following cordova plugin :

https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking



来源:https://stackoverflow.com/questions/45777446/ionic-3-deep-linking-and-lazy-loading-at-the-same-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!