Ionic 3深层连接和延迟装载同时进行

时间:2017-08-20 00:32:22

标签: angular typescript lazy-loading ionic3 deep-linking

根据我在documentationforums中所读到的内容,您可以通过以下方式启用深层链接: forRoot(appRoot,config,deepLinkConfig)

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

这导致将 ContactPage HelloPage 添加到@ngModule中的声明和entryComponents数组中,这些数组不会延迟加载。

所以,这导致了一个问题,你可以替换字符串,取消导入和双数组声明,并有这个吗?

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

同时实现延迟加载?

更新:尝试使用单个标签页。我猜它不适用于ATM。

Lazy-Loaded Deep-Linked Tabbed Page fail

1 个答案:

答案 0 :(得分:0)

我在2018年看到同样的错误。似乎深层次的链接和懒惰的加载并不能很好地协同工作。我建议使用以下cordova插件:

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