Routing is nothing but navigating between components.For eg:-in this site top menu has following links ASP.NET MVC, ANGULAR 2 AND ENTITYFRAMEWORK.
if i want to navigate from ASP.NET MVC TO ANGULAR 2.I should perform routing. Generally routes will be defined in app.module.ts
var myroutes:Routes=[
var allroutes=RouterModule.forRoot(myroutes)
In Main page, i have provided following links for the above configuration.
<a routerLink='angular2' >ANGULAR 2<a>
<a routerLink='asp.netmvc' >ASP.NET MVC<a>

ANGULAR Navigation

As you already know that navigation means to go from one place to another place.
similarly here also it is used to go from one page to another page.
Just place the below code in your page and you are done with navigation
Syntax:<a [routerLink]=['/mvcpage']> Go to ASP.NET MVC </a>
Here mvcpage means mvcpagecomponent.Likewise you can replace for your page.


The following important angular cli commands
Component: ng g component sample
The above command will create following files.

  • samplecomponent.html
  • samplecomonent.ts
  • samplecomponent.spec.ts
  • samplecomponent.css
Service : ng g service sample
The above command will create sampleservice.ts
Module: ng g module sample
The above command will create sample.module.ts
Directive: ng g directive sample