假设我有以下appRoutingModule:
export const routes: Route[] = [
{
path: '',
component: ApplicationlistComponent
}
];
@NgModule( {
imports: [ ApplicationsModule, RouterModule.forRoot( routes ) ],
exports: [ RouterModule ],
declarations: [ApplicationlistComponent]
} )
export class AppRoutingModule {
}
Run Code Online (Sandbox Code Playgroud)
使用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
Run Code Online (Sandbox Code Playgroud)
我尝试将它放在导出的const中:
export const …Run Code Online (Sandbox Code Playgroud)