configure routing first
import {RouteConfig, Router, ROUTER_DIRECTIVES} from 'angular2/router';
and
@RouteConfig([ { path: '/addDisplay', component: AddDisplay, as: 'addDisplay' }, { path: '/<secondComponent>', component: '<secondComponentName>', as: 'secondComponentAs' }, ])
then in your component import and then enter Router
import {Router} from 'angular2/router' export class AddDisplay { constructor(private router: Router) }
the last thing you need to do is call
this.router.navigateByUrl('<pathDefinedInRouteConfig>');
or
this.router.navigate(['<aliasInRouteConfig>']);
kit 02 Oct '15 at 9:35 2015-10-02 09:35
source share