title: ANGULAR: Error: Uncaught (in promise): Error: Cannot match any routes
body: <p>I'm having trouble with routing. I'm getting an error when I try to navigate to a component and I can't figure out what's the origin of the problem</p>
  
  <p>Here is the function that I use for navigating. It's located in the edit-list component (represented by ' ' in the routing module).</p>
  
  <pre><code>displayComponent(displayMode:number, index:number){
        if(!this.emptyArray){
          this.router.navigate(['edit-list/edit', displayMode, index]);
        } else {
          this.router.navigate(['edit-list/empty']);
        }  
      }
  </code></pre>
  
  <p>this the routing module for my lazy loaded component</p>
  
  <pre><code>const recipesRoutes:Routes = [
      {path:'',   component: EditCatsComponent, children: [
          {path: 'edit/:displayMode/:id/', component: CatEditComponent},
          {path: 'new', component: CatNewComponent},
          {path: 'empty', component: NoCatComponent}
          ], canActivate:[AuthGuard]}
      ];
  </code></pre>
  
  <p>And here is the error I'm getting:</p>
  
  <pre><code>core.es5.js:1020 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'edit-list/edit/1/0'
  Error: Cannot match any routes. URL Segment: 'edit-list/edit/1/0'
      at ApplyRedirects.webpackJsonp.../../../router/@angular/router.es5.js.ApplyRedirects.noMatchError (router.es5.js:1466)
      at CatchSubscriber.selector (router.es5.js:1441)
      at CatchSubscriber.webpackJsonp.../../../../rxjs/_esm5/operators/catchError.js.CatchSubscriber.error (catchError.js:105)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._error (Subscriber.js:130)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.error (Subscriber.js:104)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._error (Subscriber.js:130)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.error (Subscriber.js:104)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._error (Subscriber.js:130)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.error (Subscriber.js:104)
      at LastSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._error (Subscriber.js:130)
      at ApplyRedirects.webpackJsonp.../../../router/@angular/router.es5.js.ApplyRedirects.noMatchError (router.es5.js:1466)
      at CatchSubscriber.selector (router.es5.js:1441)
      at CatchSubscriber.webpackJsonp.../../../../rxjs/_esm5/operators/catchError.js.CatchSubscriber.error (catchError.js:105)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._error (Subscriber.js:130)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.error (Subscriber.js:104)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._error (Subscriber.js:130)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.error (Subscriber.js:104)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._error (Subscriber.js:130)
      at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.error (Subscriber.js:104)
      at LastSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._error (Subscriber.js:130)
      at resolvePromise (zone.js:824)
      at resolvePromise (zone.js:795)
      at zone.js:873
      at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:425)
      at Object.onInvokeTask (core.es5.js:3881)
      at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424)
      at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:192)
      at drainMicroTaskQueue (zone.js:602)
      at ZoneTask.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:503)
      at invokeTask (zone.js:1540)
  </code></pre>