我有一个登陆页面,它将显示用户(默认情况下)和"注册"组件,这是一组允许他们注册的输入字段.
对于返回用户,我希望他们按原样查看登录页面,然后单击"登录",只需用登录组件替换注册组件.我不希望URL改变,它应该保持'/'.
对于ui-router我可以做嵌套状态,但不确定Angular2的路由器是否支持呢?
app.ts
@Component({ selector: 'app', template: ' *snip**snip* ', directives: [Footer, ROUTER_DIRECTIVES] }) @RouteConfig([ { path: '/...', name: 'Landing', component: LandingComponent, useAsDefault: true }, { path: '/about', name 'About', component: AboutComponent } ]);
landing.ts
@Component({ selector: 'landing', template: '', directives: [ROUTER_DIRECTIVES] }) @RouteConfig([ { path: '/', name: 'RegisterForm', component: RegisterForm, useAsDefault: true }, { path: '/login', name: 'LoginForm', component: LoginForm }, ])
着陆组件的路径是否需要不同?