Angular 2 Route to root location from folder, not folder/

So I have a folder called account with the following route file:

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]);

After a user logs in I do:

this._router.navigate([this.routes.home.name]);

But this routes to …/#/account/home.

I would like to route to just /.

I also have another problem. When I am at the login page, the link to the registration page does not work with [routerLink]="['/Account/Register']. If I am at any other page it works fine.

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest
[routerLink]="['/Account/Register']

should be

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