Angular 2 Universal lazy modules not working
So I first had my entire project working without Angular's universal (server-side rendering) and then I started off with the Angular Universal starter kit, and moved my project into the appropriate directories.
Everything works now, except for any lazy loaded modules that should be loaded and bootstrapped when I navigate to a certain route. It works without using webpack and universal but not with.
Here is my routes for my main Module:
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NotFoundComponent } from './app/pages/pages';
import { AuthGuard } from './app/components/services/auth-guard.service';
const appRoutes: Routes = [
{
path: '',
redirectTo: '/hjem',
pathMatch: 'full'
},
{
path: 'my-profile',
loadChildren: 'my-profile/my-profile.module#o7MyProfileModule',
canLoad: [AuthGuard]
},
{
path: '404',
component: NotFoundComponent
},
{
path: ':slug',
component: BaseComponent
},
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
Any ideas?
找到了解决这个问题的文章:angular-2-lazy-loading-with-webpack
链接地址: http://www.djcxy.com/p/31338.html上一篇: 如何将Angular Universal项目部署到标准托管?
下一篇: Angular 2通用懒惰模块无法工作