I'm lost with my understanding, how to bring async module loading to run in latest angular-webpack-starter (RC4 with @angular/router 3.0.0-beta.2).
There is an example included, but it would be helpful to get more explanation, what to do and how this plays together.
What I did: - I exported my lazy component routes:
export const referenzRoutes: RouterConfig = [
{ path: '', component: Test3 },
{ path: 'testApp', component: TestApp },
]
then I imported and used the child routes in my parent component routes:
import {referenzRoutes} from "./+Referenz/referenz.routes";
export const routes: RouterConfig = [
{...},
{path: 'referenz', component: 'Referenz', canActivate: [ WebpackAsyncRoute ],
children: referenzRoutes},
]
and I defined async routes like this for every component:
export const asyncRoutes: AsyncRoutes = {
'Referenz': require('es6-promise-loader!./+Referenz/referenz.component'),
'TestApp': require('es6-promise-loader!./+Referenz/testApp/testApp.component'),
'Test3': require('es6-promise-loader!./+Referenz/test3/test3.component'),
};
I get an error from browser_adapter.js:84 Cannot read property 'path' of undefined when I navigate to TestApp. What is the right way to do this?
I wonder also, if the component names for async loading have to be unique for the whole application?