我有一个如下所示的路由模块:
import { NgModule } from '@angular/core';
import { Routes, RouterModule, Router} from '@angular/router';
// I need the data on the 2 lines below to be read from an external local file
import { OneComponent } from './one/one.component';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{ path: 'home', component: HomeComponent },
{path: 'one', component: OneComponent}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
导入此数据需要执行的操作:
import { OneComponent } from './one/one.component';
import { HomeComponent } from './home/home.component';
模块加载时从外部本地文件(生命周期挂钩?)
我该怎么做?