Angular 2从文件夹路由到根位置,而不是文件夹/

时间:2016-04-18 07:09:27

标签: angular routing routes angular2-routing

所以我有一个名为account的文件夹,其中包含以下路径文件:

_app.WaitForControlPropertyEqual(ApplicationUnderTest.PropertyNames.Title, 
    "TTY® 2000", 1000 * 60 * 15);
//im using 15mins

用户登录后,我执行:

import { Route, Router } from 'angular2/router';
import { Login } from './login';
import { Register } from './register';
import { Home } from '../../components/home';

export var Routes = {
    login: new Route({ path: '/', name: 'Login', component: Login }),
    register: new Route({ path: '/register', name: 'Register', component: Register }),
    home: new Route({ path: '/home', name: 'Home', component: Home })
};

export const APP_ROUTES = Object.keys(Routes).map(r => Routes[r]);

但这会路由到 ... /#/ account / home

我想路由到 /

我还有另一个问题。当我在登录页面时,注册页面的链接不适用于this._router.navigate([this.routes.home.name]); 。如果我在任何其他页面,它工作正常。

1 个答案:

答案 0 :(得分:0)

[routerLink]="['/Account/Register']

应该是

[routerLink]="['/Account', 'Register']