src/+登录/index.ts
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { LoginComponent } from './login.component';
export const routes=[
{ path:'',component:LoginComponent }
];
@NgModule({
imports: [
CommonModule,
HttpModule,
FormsModule,
RouterModule.forChild(routes)
],
declarations: [
LoginComponent
],
})
export default class Login {
static routes = routes;
}
src/app.routing.ts
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home';
export const appRoutes: Routes = [
{ path:'',component:HomeComponent },
{ path:'login',loadChildren: ()=>System.import("./+login")}
];
错误:
例外:未捕获(承诺):错误:未找到“[object Object]”的 NgModule 元数据。ac_vendor<["./node_modules/@angular/compiler/src/ng_module_resolver.js"]/NgModuleResolverhttp://127.0.0.1:3000/vendor.bundle.js:13839:23
这个问题困扰了我很久,求大神帮忙