I\'m trying to lazy load Angular 2 modules with the router, and I\'m having this error:
error_handler.js:50 EXCEPTION: Uncaught (in promise): Error: C
I landed on this question with very similar symptoms and context, so it seems useful to remark that this answer to another question helped me out.
In my specific case, I was somewhat following the lazy feature modules docs, and I even faithfully tried to replicate the associated StackBlitz example code. For some reason that example gets away with:
loadChildren: 'app/customers/customers.module#CustomersModule'
And even though my Angular CLI (v6) based experiment had similar folder structure, I needed to do either this:
// Full path including `src` at the start:
loadChildren: 'src/app/customers/customers.module#CustomersModule'
or this:
// Relative path from the `app-routing.module.ts` file:
loadChildren: './customers/customers.module#CustomersModule'
No clue why the StackBlitz example gets away with the first code example, but the other two both make sense and work for me when doing ng serve
.