不想在首页动态生成模块

时间:2018-12-18 05:22:27

标签: angular

我在这里是新手,问题是我有动态模块。当我运行项目时,所有模块都会生成。但是我不想生成所有模块,而只想生成我拥有的登录页面模块。在下面,我正在分享屏幕简短内容,并分享app.routing.ts页面代码。

import { Routes, RouterModule, PreloadAllModules  } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import { AddphyComponent } from './addphy/addphy/addphy.component';


export const routes: Routes = [
  { path: '', redirectTo: 'login/dev', pathMatch: 'full' },
  { path: 'pages', loadChildren: 'app/pages/pages.module#PagesModule' },
  { path:'login', redirectTo:'login/local', pathMatch:'full' },
  { path: 'login/dev', loadChildren: 'app/pages/login/login.module#LoginModule' },
  { path: 'login/local', loadChildren: 'app/pages/login/login.module#LoginModule' },
  { path: 'register', loadChildren: 'app/pages/register/register.module#RegisterModule' },
  { path: 'forgotpwd', loadChildren: 'app/pages/forgotpwd/forgotpwd.module#ForgotPwdModule' },
  { path: 'addphy', component: AddphyComponent },
];

export const routing: ModuleWithProviders = RouterModule.forRoot(routes, {
    preloadingStrategy: PreloadAllModules,
    useHash: true
});

enter image description here

1 个答案:

答案 0 :(得分:0)

来自Angular PreloadAllModules文档:

  

提供了一种预加载策略,该策略可以尽快预加载所有模块。

只需配置如下路由:

$zones= Store::join('cities as c','store.city_id','=','c.id')
        ->join('zones as z','c.zone_id','=','z.id')
        ->get();