簡體   English   中英

Lazyload angular 模塊正在加載到其他路由上

[英]Lazyload angular modules being loaded on another routes

我正在使用 angular 延遲加載來延遲加載我的模塊,這是我的路線:

  {
    pathMatch: 'full',
    path: '',
    loadChildren: () => import('./pages/landing/home-page/home-page.module').then(m => m.HomePageModule)
  },
  {
    path: 'web-design',
    loadChildren: () => import('./pages/landing/web-design/web-design.module').then(m => m.WebDesignModule)
  },
  {
    path: 'content',
    loadChildren: () => import('./pages/landing/content/content.module').then(m => m.ContentModule)
  },
  {
    path: 'profile',
    loadChildren: () => import('./pages/public/freelancer-profile/freelancer-profile.module').then(m => m.FreelancerProfileModule)
  },
  {
    canActivate: [LoginGuardService],
    path: 'panel',
    loadChildren: () => import('./pages/private/private.module').then(m => m.PrivateModule)
  },
  {
    path: 'freelancer',
    loadChildren: () => import('./pages/freelancer-search/freelancer-search.module').then(m => m.FreelancerSearchModule)
  },
  {
    path: '',
    loadChildren: () => import('./pages/landing/landing.module').then(m => m.LandingModule)
  },
  {
    path: '',
    loadChildren: () => import('./pages/public/public.module').then(m => m.PublicModule)
  },
  {
    path: '',
    loadChildren: () => import('./pages/public/logging/logging.module').then(m => m.LoggingModule)
  },
  {
    path: '**',
    redirectTo: '404',
  }
]; 

但是當我 go 到網絡 javascript 選項卡content.modulefreelancer-profile中的/web-design頁面時,也正在加載。

在此處輸入圖像描述

也許問題是您必須在LoginGuardService守衛內為“ content ”路徑實現CanLoad接口。 有關更多信息,我為您提供CanLoad 接口的文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM