我正在为我的angular 7项目制作一个生产版本 面对这个错误,这是我的APP-Routing.Module.ts代码,它包含常见的Routes值
这是错误消息:src \ app \ app-routing.module.ts(19,30)中的-ERROR:'AppRoutingModule'模板编译期间发生错误 装饰器不支持函数调用,但调用了“ RouterdataUrl”。
var con: RouterdataUrl = new RouterdataUrl();
const routes: Routes = con.routerdata();
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
export const routingComponents = [LeftmenuComponent, DasboardComponent, HeardermenuComponent, UserdiplayComponent,
AdsServiceComponent, UsertaskdisplayComponent, WithdrwalComponent, AllplanComponent, DaywisereportComponent]
function routerdata() {
const Routes = [
{ path: 'leftmenu', component: LeftmenuComponent },
{ path: 'dasboard', component: DasboardComponent },
{ path: 'heardermenu', component: HeardermenuComponent }
];
return Routes;
}
And here is APP MODULE CODE
//IMPORT....
@NgModule({
declarations: [
AppComponent,
routingComponents,
WithdrwalComponent,
UsertaskdisplayComponent,
AllplanComponent,
UsersqueryComponent,
DaywisereportComponent
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
BrowserAnimationsModule,
ToastrModule.forRoot(),
NgxLoadingModule.forRoot({}),
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }