Registering a new Route

Open the app.module.shared.ts file and add the following highlighted line to the existing code:

[...]@NgModule({    declarations: [        AppComponent,        NavMenuComponent,        HomeComponent,        QuizListComponent,        QuizComponent    ],    imports: [        CommonModule,        HttpClientModule,        FormsModule,        RouterModule.forRoot([            { path: '', redirectTo: 'home', pathMatch: 'full' },            { path: 'home', component: HomeComponent },            { path: 'quiz/:id', component: QuizComponent },            { path: '**', redirectTo: 'home' }        ])    ]})[...]

The meaning of this is quite straightforward; each time the app receives an HTTP request pointing to /quiz/<id>, it will load the QuizComponent, passing the <id> value as a GET parameter corresponding to the ID key.

Angular will iterate through ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.