April 2018
Beginner
536 pages
13h 21m
English
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 ...