How nested lazy loading can be achieve in angular 4.3.1? -


app working fine upload child routes accessible without '/upload' too. example '/photo', '/advertisement'. should not happen. don't know why happening. if know solution please reply.

app.routing.ts

{ path: '',   redirectto: '/dashboard', pathmatch: 'full'}, {path: '', loadchildren: 'app/campsite/campsite.module#campsitemodule'}, {path: 'login', loadchildren: 'app/login/login.module#loginmodule'} 

campsite.routing.ts

path: '', component: campsitecomponent, children: [ {path: 'dashboard', component: homecomponent, canactivate: [authguard]}, {path: 'gallery', component: gallerycomponent, canactivate: [authguard]}, {path: 'upload', loadchildren: './upload/upload.module#uploadmodule', canactivate: [authguard]} ] 

upload.routing.ts

path: '', component: uploadcomponent, children: [ {path: 'photo', component: photocomponent, canactivate: [authguard]}, {path: 'advertisement', component: advertisementcomponent, canactivate: [authguard]}, {path: 'video', component: videocomponent, canactivate: [authguard]}, {path: 'logo', component: logocomponent, canactivate: [authguard]}, { path: 'photo', pathmatch: 'full', redirectto: 'photo' } ] 

lazy component upload loading in app component routing too

this bug: https://github.com/greentube/localize-router/issues/45. :(

i have same issue. think path forward - not best, see - not lazy loading nested module until corrected:

  1. import uploadmodule campsitemodule
  2. declare routes in campsitemodule

...which very, ugly , harder maintain.

there's note in link above concerning translations, didn't try it. (it seems odd hack.)

for reference, if @ how webpack generates modules (from ng serve , such), you'll see campsite.module.chunk.js, not campsite.module.chunk.js alongside upload.module.chunk.js.

good luck!


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -