Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading module within lazy module. #4

Open
AbinayaSubbiah opened this issue Jun 19, 2017 · 0 comments
Open

Loading module within lazy module. #4

AbinayaSubbiah opened this issue Jun 19, 2017 · 0 comments

Comments

@AbinayaSubbiah
Copy link

AbinayaSubbiah commented Jun 19, 2017

Hi i need to use module within lazy module and load component into that so i modified sample from this repository bu i am getting the issue

core.umd.js?e2a5:3462 EXCEPTION: Uncaught (in promise): Error: Cannot match any routes: 'sync' Error: Cannot match any routes: 'sync'

sync.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AboutComponent } from './about.component';
const routes: Routes = [
{ path: 'sync', component: AboutComponent },
];@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [],
declarations: [AboutComponent],
providers: [],
})
export class SyncModule { }

about.module.ts
import { NgModule } from '@angular/core';

import { AboutRoutingModule } from './about.routing';

import { AboutComponent } from './about.component';

@NgModule({
imports: [
AboutRoutingModule
],
exports: [],
declarations: [AboutComponent],
providers: [],
})
export class AboutModule { }

about.routing.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { AboutComponent } from './about.component';

const routes: Routes = [
{ path: 'sync', loadChildren: './sync.module#SyncModule' },
{ path: '', redirectTo: '/sync', pathMatch: 'full' }
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AboutRoutingModule { }

app.component.html

< a routerLink="/home" routerLinkActive="active">Home < a routerLink="/about" routerLinkActive="active">About (lazy) < a routerLink="/sync" routerLinkActive="active">Sync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant