Angular 角度2中非空默认路线的路线
使用新RC路由器定义默认路由的一种方法是Angular 角度2中非空默认路线的路线,angular,angular2-routing,angular2-router,Angular,Angular2 Routing,Angular2 Router,使用新RC路由器定义默认路由的一种方法是 @Routes([{ path: '/', component: Home }]) 但是,如何在最初显示具有非空路径的页面?像 @Routes([{ path: '/home', component: Home }]) 这将永远不会显示主页内容,但我想要它 如何在新的RC1路由器中实现这一点?=RC.4 { path: '', redirectTo: '/home', pathMatch: 'full' } { path: '/home', c
@Routes([{ path: '/', component: Home }])
但是,如何在最初显示具有非空路径的页面?像
@Routes([{ path: '/home', component: Home }])
这将永远不会显示主页内容,但我想要它
如何在新的RC1路由器中实现这一点?=RC.4
{ path: '', redirectTo: '/home', pathMatch: 'full' }
{ path: '/home', component: Home }
对于rc4,您可以像这样使用通配符路由
{路径:'**',重定向到:'link/to/default/route'}
我认为设置超时()
是没有必要的(经过最近的一些测试)。由于最新的路由器rc1,我停止使用angular 2。。。谢谢你。
export class DummyComponent {
constructor(private router:Router) {
setTimeout(() => this.router.navigate('/home'));
}
}