July 2018
Intermediate to advanced
420 pages
8h 46m
English
As you saw previously, routes are part of every web application. Now, we will add a new route, so that we can access the content of our beers module. Open src/app/app-routing.module.ts and replace the code with the following:
import { NgModule } from '@angular/core';import { Routes, RouterModule } from '@angular/router';import { AppComponent } from './app.component';import { BeersComponent } from './beers/beers.component';const routes: Routes = [ { path: '', redirectTo: 'beers', pathMatch: 'full' }, { path: 'beers', component: BeersComponent }];@NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule]})export class AppRoutingModule { }Note that we are just adding the new route to an existing route ...
Read now
Unlock full access