You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lazy modules in shared project through page-router-outlet. #1635
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
CLI: 5.0.1
NativeScript-Angular: 7.0.2
Angular: 7.0.4
reproduced on android.
Describe the bug
Lazy loaded module is not found with a relative or absolute path in a shared project.
That is not to say that lazy modules don't work at all, but they fail through page-router-outlet.
Routes are as follows:
JS: Error: Cannot find module './app/tabs/tabs.module'
JS: at file:///data/data/org.nativescript.logintabsngshared/files/app/bundle.js:161:11 [angular]
JS: at Object.onInvoke (file:///data/data/org.nativescript.logintabsngshared/files/app/vendor.js:46613:33) [angular]
JS: at file:///data/data/org.nativescript.logintabsngshared/files/app/vendor.js:68322:34 [angular]
JS: at Object.onInvokeTask (file:///data/data/org.nativescript.logintabsngshared/files/app/vendor.js:46604:33) [angular]
Funny enough, if loadChildren is changed to "~/app/tabs/tabs.module#TabsModule" while in live sync then module is resolved. However, module is not found with this link the very next time project is restarted in cli.
To Reproduce
Create new project with ng new --collection=@nativescript/schematics project-name --shared and replace app folder with app folder from https://github.com/ADjenkov/login-tabs-ng project.
Try running. Or use sample project which was created this way:
@NickIliev, Thank you for the response.
I was able to fiddle laziness into existence some time ago in the fresh project with tilde and latest nativescript, this report and sample project only came to life because of different liveview vs fresh start behavior I've experienced at that time which can be replicated in the sample project.
Ticket can be closed, however, as I have this working as expected now and sample project might be okay as well on latest versions, ain't nobody got time for that.
Hi @artu-ole ,
Every unnamed <page-router-outlet> or <router-outlet> automatically gets default name set -"primary". In order to navigate back this specific unnamed <page-router-outlet> you have to specify his name which is "primary" by default.
Activity
NickIliev commentedon Dec 12, 2018
@artu-ole Use the updated project that we migrated withint the NativeScript organization. It is the same project that @ADjenkov created but with some minor updates like the nsRouterLink navigation to the lazily loaded module and with the usage of tilde (
~) instead of dot for the module path.Notice that some of the functionalities are not officially released so we are using the
nextof nativescript-angularartu-ole commentedon Dec 12, 2018
@NickIliev, Thank you for the response.
I was able to fiddle laziness into existence some time ago in the fresh project with tilde and latest nativescript, this report and sample project only came to life because of different liveview vs fresh start behavior I've experienced at that time which can be replicated in the sample project.
Ticket can be closed, however, as I have this working as expected now and sample project might be okay as well on latest versions, ain't nobody got time for that.
artu-ole commentedon Dec 12, 2018
Quick question, outlet
primarydoesn't exist, is this a left over?ADjenkov commentedon Dec 12, 2018
Hi @artu-ole ,
Every unnamed
<page-router-outlet>or<router-outlet>automatically gets default name set -"primary". In order to navigate back this specific unnamed<page-router-outlet>you have to specify his name which is "primary" by default.