angular generate routing code example
Example 1: generate module with routing in angular
ng g m [ModuleName] --routing
Example 2: call a function whenever routerlink is clicke angular
<a class="nav-link" [routerLink]="['/home']" (click)="doSomeLogic()">Home</a>
Example 3: 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
Example 4: how to create app.routing.module.ts in angular 6
ng generate module app-routing --flat --module=app