1

I have two Modules that i am loading those modules with lazy loading.

  1. AppModule
  2. PassangerModule

AppModule is defined as follow

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        CabModule,
        RouterModule.forRoot([
            { path: '', component: CabComponent },
            { path: 'Cabs', component: CabComponent },
            { path: 'Passanger', loadChildren: 'App/Passanger/passanger.module#PassangerModule' }
        ])
    ],
    declarations: [
        AppComponent,
        CabComponent,
        CabFilterPipe,
        CabAddComponent
    ],
    bootstrap: [AppComponent],
    providers: [
        CabService
    ]
})
export class AppModule { }

and ProductModule is defined as follow:

@NgModule({
    imports: [
        CommonModule,
        RouterModule.forChild([
            {
                path: '', component: PassangerComponent
            }
        ])
    ],
    declarations: [
        PassangerComponent
    ],
    providers: [
        PassangerService
    ]
})
export class PassangerModule {
}

Now when I navigated to /Products it does not work and tries GET request on http://localhost:3000/App/Passanger/passanger.module which is not valid path instead it should apply GET on passanger.module.js

I doubled checked that it is having defaultExtension as js in systemjs.config.js

1 Answer 1

1

I changed the route module path and make App/... to lower case app/... and it worked.

I don't know why that string is case sensitive but it worked for me.

RouterModule.forRoot([
            { path: '', component: CabComponent },
            { path: 'Cabs', component: CabComponent },
            { path: 'Passanger', loadChildren: 'app/Passanger/passanger.module#PassangerModule' }
        ])
Sign up to request clarification or add additional context in comments.

3 Comments

Interesting! So it looks like the path is case sensitive then
@FredrikLundin folder name is App not app. Don't know why but it only works with lowercase name.
Reason for this tsconfig.json has option --forceConsistentCasingInFileNames by defaulse false. you can check this on below link typescriptlang.org/docs/handbook/compiler-options.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.