Optional params in router-lite by params object

In router-lite it is possible to pass an unconfigured and optional parameter like:

 this.router.load({
     component: 'product-id',
     params: { id: 'product-1', optionalParam: 'test132' },
 });

The optional param is provided by the params object, but cannot be read from there:

loading(params: Params, next: RouteNode) {
 this.id = params.id;
 // this.optionalParam = params.optionalParam; <- this is not working
 this.optionalParam = next.queryParams.get('optionalParam');
}

Is this by design or could this be simplified?

This is by design. I think you are referring the unconfigured parameters by the “optional” parameters. Those parameters will be transferred to querystring by default. Hence, API wise it makes more sense to access the values from query string. The params is only for the configured parameters.

Thanks for the feedback!