2016-07-30 153 views

回答

2
import { provideRouter, RouterConfig } from '@angular/router'; 

    const routes: RouterConfig = [ 
     { path: '**', component: PageNotFoundComponent } 
    ]; 

    export const appRouterProviders = [ 
     provideRouter(routes) 
    ]; 

的**表示用于我们的路线通配符路径。如果请求的URL不匹配我们配置中定义的路由的任何 路径,则 路由器将匹配此路由。这对于 显示404页面或重定向到其他路线很有用。

看看路由器docs

+0

的信息可以更准确地发现了[配置部分(https://angular.io/docs/ts/latest/guide/router.html#配置文档链接提供的链接以及[RouterConfig API](https://angular.io/docs/ts/latest/api/router/index/RouterConfig-type-alias.html#wild-卡)文档页面。 – edmundo096