injectQueryParams
is a helper function that allows us to inject query params from the current route as a signal.
Having query params as a signal helps in a modern angular signals based architecture.
Import
Usage
Get all query params
injectQueryParams
when it’s called, returns a signal with the current query params.
Or, if we want to transform the query params, we can pass a function to injectQueryParams
.
Get a single value
If we want to get the value for a specific query param, we can pass the name of the query param to injectQueryParams
.
If we want to additional transform the value into any shape, we can pass a transform
function.
If we want to use a default value if there is no value, we can pass a initialValue
.
Get an array value
If we want to get the values for a specific query param, we can pass the name of the query param, to injectQueryParams.array
.
If we want to additional transform the values into any shape, we can pass a transform
function.
If we want to use a default value if there are no values, we can pass a initialValue
.