O'Reilly logo

Bootstrap 4 Site Blueprints by Ian Whitley, David Cochran, Bass Jobsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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>`, 
     directives: [ ROUTER_DIRECTIVES ] 
    }) 
export class AppComponent { } 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required