zoukankan      html  css  js  c++  java
  • [Angular2 Router] Index router

    Index router as default router.

    import {RouterModule} from "@angular/router";
    import {NotFoundComponent} from "./shared-components/not-found/not-found.component";
    
    const indexRoute = {path: '', redirectTo: 'home', pathMatch: 'full'};
    const fallbackRoute = {path: '**', component: NotFoundComponent};
    const routes = [
      {path: 'legacy-url', redirectTo: '/home', pathMatch: 'prefix'},
      {path: 'home', loadChildren: 'app/home/home.module', name: 'Home'},
      {path: 'heros', loadChildren: 'app/heros/heros.module', name: 'Heros'},
      {path: 'contact', loadChildren: 'app/contact/contact.module', name: 'Contact'},
      {path: 'message', loadChildren: 'app/message/message.module', name: 'Message'},
      {path: 'playground', loadChildren: 'app/playground/playground.module', name: 'Playground'},
      {path: 'realtime', loadChildren: 'app/realtime/realtime.module', name: 'Realtime'},
      {path: 'wiki-path', loadChildren: 'app/auxroute/auxroute.module', name: 'WikiDetail', outlet: 'wiki'},
      {path: 'courses', loadChildren: 'app/courses/courses.module', name: 'Courses'},
      indexRoute,
      fallbackRoute,
    ];
    
    export default RouterModule.forRoot(routes, {useHash: true});

    Index router, usually comes as last, just right before the fallback router.

  • 相关阅读:
    [luogu p1164] 小A点菜
    [luogu p5018] 对称二叉树
    [luogu p1305] 新二叉树
    [luogu p1030] 求先序排列
    [luogu p1087] FBI树
    [luogu p1449] 后缀表达式
    [luogu p1160] 队列安排
    [luogu p1057] 传球游戏
    有趣的问题系列-主元素问题
    [luogu p1192] 台阶问题
  • 原文地址:https://www.cnblogs.com/Answer1215/p/5946312.html
Copyright © 2011-2022 走看看