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

Adding routing to our app

To learn more about routing in Angular 2, and for better understanding of the coming steps, you can visit the following URL: https://angular.io/docs/ts/latest/tutorial/toh-pt5.html.

Our simple website has the following pages: Home, Features, Pricing, and About. So we have to create four new components (views). For the home page, create a file call in home.component.ts in the app folder. The home.component.t s file should contain the following TypeScript code:

import { Component } from '@angular/core'; 
@Component({ 
  selector: 'home', 
  template: '<h3>Home</h3>' 
}) 
export class HomeComponent { 
} 

Repeat the preceding steps for each page, and create the features, component.ts, pricing.component.ts, and about.component.ts files ...

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