问题
I have a project using Angular and Nativescript, and we'd like to use the same routes.
Here's how my routes look like:
{
path: '',
component: BaseComponent
},
{
path: 'details',
//loadChildren: '~/app/Routes/base/details/details.module#DetailsModule',
loadChildren: './details/details.module#DetailsModule',
}
The commented one works on Nativescript, but not on Angular. The other one works on Angular but not on Nativescript.
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 :)
回答1:
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
来源:https://stackoverflow.com/questions/54361588/how-to-use-same-path-in-loadchildren-for-nativescript-and-angular