2

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?

Gerardlamo
  • 1,035
  • 10
  • 19

0 Answers0