次の appRoutingModule があるとします。
export const routes: Route[] = [
{
path: '',
component: ApplicationlistComponent
}
];
@NgModule( {
imports: [ ApplicationsModule, RouterModule.forRoot( routes ) ],
exports: [ RouterModule ],
declarations: [ApplicationlistComponent]
} )
export class AppRoutingModule {
}
これをngc cli コマンドでコンパイルすると、次のエラーが発生します。
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
エクスポートされたconstの中に入れてみました:
export const routerModule = RouterModule.forRoot( routes );
しかし、それはこのエラーを与えるでしょう:
Error: Error encountered resolving symbol values statically
これを機能させるための回避策/修正は何ですか? RouterModule にルートを渡すことができない場合、どうすればルートを定義できますか?
私はバージョンを使用しています:
"@angular/compiler": "~2.4.0",
"@angular/compiler-cli": "~2.4.0",
"@angular/platform-server": "~2.4.0",
"@angular/router": "~3.4.0"
等