2017-09-02 10 views
1

FEHLER in Fehler beim Auflösen der Symbolwerte statisch. Referenz auf ein lokales (nicht exportiertes) Symbol 'protectedRoutes'. Ziehen Sie in Erwägung, das Symbol (Position 9: 7 in der ursprünglichen .ts-Datei) zu exportieren und das Symbol ProtectedRouteModule in /protected/protected.routes.tsAngular 4 Eager Last Lambda Funktion

aufzulösen. Bitte geben Sie an, wie Sie das Problem lösen können.

const protectedRoutes: Routes = [ 
     { 
     path: 'protected', 
     component: LayoutComponent, 
     canActivate: [AuthGuard], 
     children:[ 
      { path:'', redirectTo: 'contact', pathMatch:'full'}, 
      { path:'support', loadChildren:() => SupportModule}, 
      { path:'contact', loadChildren:() => ContactModule}, 
      // { path:'support', loadChildren:'./support/support.module#SupportModule'}, 
      // { path:'contact', loadChildren:'./support/contact.module#ContactModule'}, 
     ] 
     } 
    ]; 

    @NgModule({ 
     imports: [RouterModule.forRoot(protectedRoutes)], 
     exports: [RouterModule] 
    }) 
    export class ProtectedRouteModule { } 

Antwort

1

Sie müssen die Funktion exportieren, wie die Fehlermeldung sagt.

export function loadSupportModule() { 
    return SupportModule 
} 

Dann verwenden Sie es.

{ path:'support', loadChildren: loadSupportModule }