Попробуйте сделать так:
router.module:
import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import { LayoutComponent } from '../shared/layout/layout.component';
export const routes: Routes = [
{ path: '', redirectTo: 'adminca', pathMatch: 'full' },
{ path: 'adminca', component: LayoutComponent}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules });
app.module:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { SharedModule } from './shared/shared.module';
import { routing } from './routing.module';
import { AuthModule } from './modules/auth/auth.module';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, RouterModule, SharedModule, routing, AuthModule],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
layout.module:
import { NgModule, ModuleWithProviders, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { routing } from './layout.routes';
import { StartPageComponent } from '../../modules/start-page/start-page.component';
import { SystemUsersComponent } from '../../modules/system-users/system-users.component';
import { LayoutComponent } from './layout.component';
@NgModule({
declarations: [StartPageComponent, SystemUsersComponent, LayoutComponent],
imports: [CommonModule, RouterModule, routing],
providers : [],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class LayoutModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: LayoutModule,
providers: []
};
}
}
layout.routes:
import { Routes, RouterModule } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import { StartPageComponent } from '../../modules/start-page/start-page.component';
import { SystemUsersComponent } from '../../modules/system-users/system-users.component';
import { LayoutComponent } from './layout.component';
export const routes: Routes = [
{
path: 'adminca',
component: LayoutComponent,
children: [
{ path: '', redirectTo: 'start-page', pathMatch: 'full' },
{ path: 'start-page', component: StartPageComponent },
{ path: 'system-users', component: SystemUsersComponent }
]
}
];
export const routing: ModuleWithProviders = RouterModule.forChild(routes);
Иначе, дайте полную ошибку.