simple angular routing example
Example 1: angular navigate using component
import {Router} from '@angular/router';
export class Component{
constructor(private route:Router){}
go(){
this.route.navigate(['/page']);
}
}
Example 2: angular router navigate
goPlaces() {
this.router.navigate(['/', 'page-name']);
}
Example 3: angular routing example
content_copy
const routes: Routes = [
{ path: 'first-component', component: FirstComponent },
{ path: 'second-component', component: SecondComponent },
];
Example 4: angular routing example
content_copy
import { FirstComponent } from './first/first.component';
import { SecondComponent } from './second/second.component';