Error: Cannot match any routes. URL Segment: 'set/4DEjDIwExmgjJGPdvtto'

I’m facing a routing issue. I want to navigate to set page however there are error saying it cant be match, I dont really know what is wrong with the code. The error is as below

Error: Cannot match any routes. URL Segment: ‘set/4DEjDIwExmgjJGPdvtto’

Here is my app-routing.module.ts

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  { path: 'login', loadChildren: './login/login.module#LoginPageModule' },
  { path: 'register', loadChildren: './register/register.module#RegisterPageModule' },
  { path: '', redirectTo: 'login', pathMatch: 'full' },
  { path: '', loadChildren: './pages/tabs/tabs.module#TabsPageModule' },
  { path: 'set', loadChildren: './pages/set/set.module#SetPageModule' },
  { path: 'set/id', loadChildren: './pages/set/set.module#SetPageModule' }
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule { }

This is my tab2.html

<ion-header>
    <ion-toolbar color="primary">
      <ion-title>Alert lists</ion-title>
    </ion-toolbar>
  </ion-header>

  <ion-content>
    <ion-fab vertical="bottom" horizontal="end" slot="fixed">
      <ion-fab-button routerLink="/set">
        <ion-icon name="add"></ion-icon>
      </ion-fab-button>
    </ion-fab>

    <ion-list>
      <ion-item button [routerLink]="['/set', set.id]" *ngFor="let set of (sets | async)">
        {{ set.notes }}
      </ion-item>
    </ion-list>
  </ion-content>

Can anyone help me with this, thank you

1 Like

Error fixed, there is typo in code
{ path: 'set/:id', loadChildren: './pages/set/set.module#SetPageModule' }