# Optional params in router-lite by params object

**URL:** <https://discourse.aurelia.io/t/optional-params-in-router-lite-by-params-object/5142>\
**Category:** vNext\
**Created:** [April 5, 2023, 9:43am UTC](https://discourse.aurelia.io/t/optional-params-in-router-lite-by-params-object/5142 "2023-04-05T09:43:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elitastic](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitastic/32/1787_2.png) [@elitastic](https://discourse.aurelia.io/u/elitastic)\
**Post date:** [April 5, 2023, 9:43am UTC](https://discourse.aurelia.io/t/optional-params-in-router-lite-by-params-object/5142/1 "2023-04-05T09:43:40Z")

</div>

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

```auto
 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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![Sayan751](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/sayan751/32/1861_2.png) [@Sayan751](https://discourse.aurelia.io/u/Sayan751)\
**Post date:** [April 5, 2023, 1:23pm UTC](https://discourse.aurelia.io/t/optional-params-in-router-lite-by-params-object/5142/2 "2023-04-05T13:23:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![elitastic](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitastic/32/1787_2.png) [@elitastic](https://discourse.aurelia.io/u/elitastic)\
**Post date:** [April 5, 2023, 1:46pm UTC](https://discourse.aurelia.io/t/optional-params-in-router-lite-by-params-object/5142/3 "2023-04-05T13:46:03Z")

</div>

Thanks for the feedback!
