码迷,mamicode.com
首页 > 其他好文 > 详细

[Angular2 Router] Index router

时间:2016-10-10 19:12:57      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

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.

[Angular2 Router] Index router

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/5946312.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!