I am working through an Angular training course (using Angular 12).
{ path: 'training', loadChildren: './training/training.module.ts#TrainingModule'},
is not working:
Unhandled Promise rejection: Cannot find module './training/training.module.ts' ; Zone: ; Task: Promise.then ; Value: Error: Cannot find module './training/training.module.ts
I am 100% certain that the path from app-routing.module.ts
, which contains this code, is correct (I copy/pasted it, to make sure).
However, a previous course (by the same presenter), makes me think that the correct syntax ought to be:
{path: 'training', loadChildren: () => import('./training/training.module').then(module => module.TrainingModule)}
Why these two possibilities? Are they functionally equivalent? When should I use which?