Adding Routes
An Example Router
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Stackblitz Demo
Route Order
One of the key things to know about routing configuration is that the order matters a lot. When the router receives an URL, it will start going through the routes array in order: starting with the first index of the configuration array. If it finds a match to the complete URL, it stops and instantiates
Last updated