Setting up navigation
The original app component (app/app.component.ts
) should only handle navigation now. So edit the app/app.component.ts
file so that it contains the following TypeScript code:
import { Component } from '@angular/core'; import { ROUTER_DIRECTIVES } from '@angular/router'; @Component({ selector: 'my-app', template: `<ul> <li><a [routerLink]="['/home']" routerLinkActive="active">Home</a></li> <li><a [routerLink]="['/features']" routerLinkActive="active">Features</a></li> <li><a [routerLink]="['/pricing']" routerLinkActive="active">Pricing</a></li> <li><a [routerLink]="['/about']" routerLinkActive="active">About</a></li> </ul> <router-outlet></router-outlet>`, ...