Let's say I have the following appRoutingModule:
export const routes: Route[] = [ { path: '', component: ApplicationlistComponent } ]; @NgModule( { imports: [ ApplicationsModule, RouterModule.forRoot( routes ) ], exports: [ RouterModule ], declarations: [ApplicationlistComponent] } ) export class AppRoutingModule { }
When compiling with the ngc cli command, it will throw the following error:
Error: Error encountered resolving symbol values statically. Calling function 'RouterModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppRoutingModule in C:/git/mxt-frontend/landing-page-client/src/client/app/app-routing.module.ts, resolving symbol AppRoutingModule in C:/git/mxt-frontend/landing-page-client/src/client/app/app-routing.module.ts
I tried putting it in an exported constant:
export const routerModule = RouterModule.forRoot( routes );
But this will give this error:
Error: Error encountered resolving symbol values statically
What workaround / fix to make this work? How to determine my routes if I cannot pass it to the RouterModule?
I am using versions:
"@angular/compiler": "~2.4.0", "@angular/compiler-cli": "~2.4.0", "@angular/platform-server": "~2.4.0", "@angular/router": "~3.4.0"
and etc.
source share