延迟加载角7

问题描述 投票:0回答:1

我才刚刚开始学习延迟加载。我创建了自己的名为user.module.ts的模块我想在routes.ts中向该模块添加一条路由但是,我在./$$_lazy_route_resource惰性名称空间对象错误中得到了错误。我正在使用角度7.1.2

export const appRoutes: Routes = [
  { path: 'events/new', component: CreateEventComponent, canDeactivate: ['canDeactivateCreateEvent'] },
  { path: 'events', component: EventsListComponent, resolve: { events: EventListResolver } },
  { path: 'events/:id', component: EventDetailsComponent, canActivate: [EventRouteActivator] },
  { path: '404', component: Error404Component },
  { path: '', redirectTo: '/events', pathMatch: 'full' },
  { path: 'user', loadChildren: './user/user.module#UserModule' }
import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { RouterModule } from '@angular/router'

import { userRoutes } from './user.routes'
import { ProfileComponent } from './profile.component'

@NgModule({
  declarations: [
    ProfileComponent
  ],
  imports: [
    CommonModule,
    RouterModule.forChild(userRoutes)
  ],
  providers: [

  ]
})

export class UserModule { }

错误:

ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve 'C:\Users\Roy Miao\Documents\Work\Angular\Intermediate\ng-fundamentals\src\app\user\user.module.nggactory.js' 
in 'C:\Users\Roy Miao\Documents\Work\Angular\Intermediate\ng-fundamentals\$$_lazy_route_resource

很抱歉,如果由于格式而难以阅读,我是堆栈溢出的新手。谢谢!

angular lazy-loading
1个回答
0
投票

你好我通过了官方文档,请检查路线的一部分,在那里您将看到它使用了进口official documentation

© www.soinside.com 2019 - 2024. All rights reserved.