问题
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