angular overview module component routes code example
Example 1: angular navigate using component
import {Router} from '@angular/router'; // import router from angular router
export class Component{ // Example component..
constructor(private route:Router){}
go(){
this.route.navigate(['/page']); // navigate to other page
}
}
Example 2: ng new module w route
// Use this command to create a lazy-loaded feature module with routing, along with its stub component.
ng generate module <MODULE_NAME> --route <ROUTE> --module app.module