Skip to Content
Learning TypeScript 2.x - Second Edition
book

Learning TypeScript 2.x - Second Edition

by Remo H. Jansen
April 2018
Beginner content levelBeginner
536 pages
13h 21m
English
Packt Publishing
Content preview from Learning TypeScript 2.x - Second Edition

Working with the Angular router

Earlier in this chapter, we mentioned a component known as the router-outlet. The component was used by the Layout component as follows:

<main> 
    <router-outlet></router-outlet> 
</main> 

However, this component was not defined by us because it is defined by the @angular/router npm module. In order to use the module, we must import it and declare a NgModule that exports RouteModule. We must also declare the configuration for the router. The configuration is a map or a dictionary that links a given path with a given component:

import { NgModule } from "@angular/core"; import { Routes, RouterModule } from "@angular/router"; import { HomePageComponent } from "./pages/homepage.component"; import { MoviesPageComponent ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering TypeScript - Fourth Edition

Mastering TypeScript - Fourth Edition

Nathan Rozentals
Learning TypeScript

Learning TypeScript

Josh Goldberg
TypeScript for Beginners

TypeScript for Beginners

Bharath Thippireddy

Publisher Resources

ISBN: 9781788391474Supplemental Content