javascript - Angular 2 - Cannot find module in nested routes -


i try use lazyload routes nested. still error not find module in 2 level route.

here construct:

app.module.ts:

import { browsermodule } '@angular/platform-browser'; import { ngmodule } '@angular/core'; import { formsmodule } '@angular/forms'; import { httpmodule } '@angular/http'; import { routing } './app.routes'; import { appcomponent } './app.component'; import { routermodule } '@angular/router';  @ngmodule({   declarations: [     appcomponent,     authcomponent   ],   imports: [     browsermodule,     formsmodule,     httpmodule,     routing   ],   exports: [routermodule],   providers: [],   bootstrap: [appcomponent] }) export class appmodule { } 

app.routes.ts

import { router, routermodule} '@angular/router'; import { authguard } './auth/services/auth-guard.service'; import { authcomponent } './auth/auth.component';  export const routing = routermodule.forroot([     { path: '', redirectto: "portal", pathmatch: 'full'},     { path: 'portal', loadchildren: './portal/portal.module#portalmodule'},     { path: '**', redirectto: "portal"} ]) 

portal/portal.module.ts:

import { ngmodule } '@angular/core'; import { routing } './portal.routes'; import { portalcomponent } './portal.component'; import { formsmodule,reactiveformsmodule } '@angular/forms';  import { routermodule } '@angular/router'; import { commonmodule } '@angular/common';  @ngmodule({   imports: [     commonmodule,     formsmodule,     reactiveformsmodule,     routing   ],   exports: [ routermodule ],   declarations: [     portalcomponent   ],   providers: [   ] }) export class portalmodule { } 

portal/portal.routes.ts:

import { router, routermodule} '@angular/router'; import { portalcomponent } './portal.component';  export const routing = routermodule.forchild([     { path: '', redirectto: "reports"},     // part doesn't work      { path: 'reports', component: portalcomponent, loadchildren: './portal/test/test.module#testmodule'},     // --     { path: '**',component: portalcomponent, pathmatch: 'full'} ]) 

portal/test/test.module.ts:

import { ngmodule } '@angular/core'; import { routing } './test.routes'; import { testcomponent } './test.component'; import { formsmodule,reactiveformsmodule } '@angular/forms';  import { routermodule } '@angular/router'; import { commonmodule } '@angular/common';  @ngmodule({   imports: [     commonmodule,     formsmodule,     reactiveformsmodule,     routing   ],   exports: [ routermodule ],   declarations: [     testcomponent   ],   providers: [   ] }) export class testmodule { } 

portal/test/test.routes:

import { router, routermodule} '@angular/router'; import { testcomponent } './test.component';  export const routing = routermodule.forchild([     { path: '', redirectto: "reports"},     { path: 'reports', component: testcomponent}, ]) 

my error:

exception: uncaught (in promise): error: cannot find module './portal/test/test.module'. error: cannot find module './portal/test/test.module'. 

my question why not find module ? tried other paths 1 can work think.

what need fix or angular 2 not able ?

(the error testet ng serve not build | testet chrome)

not sure if way modules name every module file index.ts , specify path folder when referencing them. have never had issues modules not being found. have @ https://github.com/angularclass/angular2-webpack-starter/tree/master/src/app example in how load async modules.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -