Easy way to distinguish between Angular's path and matrix parameters from a route

Viewed 113

Angular's ActivatedRoute class has a params Observable that emits the path and matrix params on the activated route. So if I have the following route:

{
  path: 'foo/:id',
  component: Foo
}

Navigating between foo/1 and foo/2 causes this Observable to emit {id: 1} and {id: 2} accordingly. If I navigate between foo/1;fruit=apple and foo/1;fruit=orange, the Observable emits {fruit: 'apple'} and {fruit: 'orange'} accordingly.

In my case, I really only care about path param emissions. Is there an easy way to somehow filter out the matrix params or only subscribe to the path params through some other means? My only idea thus far is to either (1) parse the full URL to distinguish between the types of params or (2) parse the URLSegments of the route for the path param changes.

Thanks!

0 Answers
Related