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 this with the ngc cli command it will give 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 inside an exported const:
export const routerModule = RouterModule.forRoot( routes );
But that will give this error:
Error: Error encountered resolving symbol values statically
What is the workaround/fix to get this working? How do i define my routes if i can't pass it to the RouterModule?
I'm using versions:
"@angular/compiler": "~2.4.0",
"@angular/compiler-cli": "~2.4.0",
"@angular/platform-server": "~2.4.0",
"@angular/router": "~3.4.0"
etc.
I resolved this by reverting angular back to version 2.3.1. Looks like it's broken in the 2.4.0 release..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With