rdkcentral / Lightning-SDK

SDK for Lightning framework
Apache License 2.0
130 stars 69 forks source link

Allow optional parameters to be specified in the Lightning Router path #350

Closed pragna-hub closed 1 year ago

pragna-hub commented 2 years ago

As of now with the latest SDK, there is no option in router path to specify optional parameters.

For example: if I want to make the playlistId, an optional field in the below path, it would not be possible. { path: 'player/:assetId/:playlistId', component: Player }

I would either need to specify two different routes to the same component.

It would be very helpful to have a way to specify optional fields in router path with a '?' suffix for the optional params.

example: { path: 'player/:assetId/:playlistId?', component: Player }

would route to

http://some/url#player/1 http://some.url#player/1/2

michielvandergeest commented 2 years ago

Hi @pragna-hub thanks for this suggestion. This looks like a valuable addition to the Router. We'll pick up adding this functionality within the team