1import {Router} from '@angular/router'; // import router from angular router
2
3export class Component{ // Example component..
4 constructor(private route:Router){}
5
6 go(){
7 this.route.navigate(['/page']); // navigate to other page
8 }
9}
1
2 content_copy
3
4 const routes: Routes = [
5 { path: 'first-component', component: FirstComponent },
6 { path: 'second-component', component: SecondComponent },
7];
8
1
2 content_copy
3
4 import { FirstComponent } from './first/first.component';
5import { SecondComponent } from './second/second.component';
6