generator-angular2-with-router
Version:
A simple angular2 application having 3 pages with angular2 in build router to navigate between pages. It have all basic functionality which a standard angualr2 application needed.
31 lines (25 loc) • 774 B
text/typescript
import {Component, OnInit} from '@angular/core';
import {HomeService} from "../home/home.service";
import {Router} from "@angular/router";
({
selector: 'add',
templateUrl: 'app/components/add/add.component.html',
})
export class AddComponent extends OnInit {
private outlet: any = {
breadcrumbs: 'breadcrumbs',
header: 'header',
message: 'message',
heading: null,
summary: 'summary',
footer: 'footer'
};
constructor(private router: Router,
public homeService: HomeService) {
super();
}
ngOnInit(): void {
this.router.navigate(['', {outlets: this.outlet}], {skipLocationChange: true});
}
//router.navigateByUrl('/home/(route1:page1//route2:page2//route3:page3)');
}