lazy loading - Angular 2, chunk for children routes not createds if create array of children befor Routes object -
my children routes works when create them like:
let routes: routes = [ { path: '', component: maincomponent, children: [ {path: 'a', loadchildren: '../+a/a.module.ts#amodule', canload: [aguard]}, {path: 'b', loadchildren: '../+b/b.module.ts#bmodule', canload: [bguard]} ] } ]; and chunks created modules, when try init children before this, stop working, , don t have chunks modules:
let children: routes = []; children.push({path: 'a', loadchildren: '../+a/a.module.ts#amodule', canload: [aguard]}) children.push({path: 'b', loadchildren: '../+b/b.module.ts#bmodule', canload: [bguard]}) let routes: routes = [ { path: '', component: maincomponent, children: children } ]; and strange, think same code.
try define children generic array instead type router.
let children:any = []; children.push({path: 'a', loadchildren: '../+a/a.module.ts#amodule', canload: [aguard]}) children.push({path: 'b', loadchildren: '../+b/b.module.ts#bmodule', canload: [bguard]}) let routes: routes = [ { path: '', component: maincomponent, children: children } ];
Comments
Post a Comment