如何在loadChildren中为Nativescript和Angular使用相同的路径? [英] How to use same path in loadChildren for Nativescript and Angular?
问题描述
我有一个使用Angular和Nativescript的项目,我们希望使用相同的路线.
I have a project using Angular and Nativescript, and we'd like to use the same routes.
这是我的路线:
{
path: '',
component: BaseComponent
},
{
path: 'details',
//loadChildren: '~/app/Routes/base/details/details.module#DetailsModule',
loadChildren: './details/details.module#DetailsModule',
}
评论的对象适用于Nativescript,但不适用于Angular.另一个在Angular上有效,但在Nativescript上无效.
The commented one works on Nativescript, but not on Angular. The other one works on Angular but not on Nativescript.
如何在没有2个文件的情况下使用相同的路径在Nativescript和Angular中延迟加载模块?
How can I use the same path to lazy load my module in Nativescript AND Angular, without having 2 files?
提前谢谢! 祝你有美好的一天:)
Thanks in advance! Have a great day :)
推荐答案
如果有人遇到此问题,可以执行以下操作:
In case someone's having this problem, you can do this:
{
path: '',
component: BaseComponent
},
{
path: 'details',
loadChildren: () => DetailsModule,
}
导入是平台的相对路径并且可以正常工作
The import is a relative path and work wit both of the platform
这篇关于如何在loadChildren中为Nativescript和Angular使用相同的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!