0

One of the routes in my Angular 6 application is defined as below -

{ path: 'product/:productId', component: ProductPageComponent }

Now, I want to handle URLs like /product/BEV15733/Raw-Apple-Cider-Vinegar with this (i.e. I want to ignore the third path segment). However, when navigating, Angular throws error like -

Error: Cannot match any routes. URL Segment: 'product/BEV15733/Raw-Apple-Cider-Vinegar'

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
jaibatrik
  • 6,770
  • 9
  • 33
  • 62

1 Answers1

0

Maybe this will work:

{ path: 'product/:productId/:ignoreParam', component: ProductPageComponent }

With ':' you expect a param in your url, and you can ignore this last segment.

mp92
  • 92
  • 5