Q:

Angular 7 - Define routes with queryParams

I want to declare two Angular routes: 

For a specific item (/items?id=SOME_ITEM_ID)
For a list of all items (/items)

As the following isn't working, I want to know how I can define my routes to suite my needs?
export const routes: Routes = [
    { path: 'items?id=someItemId', component: ItemComponent },
    { path: 'items', component: AllItemsComponent },
];

A:

I think you don't want queryParams but params, you should define your route like this :
export const routes: Routes = [
    { path: 'items/:id', component: ItemComponent },
    { path: 'items', component: AllItemsComponent },
];

As @cgTag says in comment, queryParams are transparent and you don't need to declare them in route definition.

