
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
ember-query-param-helpers
Advanced tools
This add-on provides a few helpers to help tame query params in your Ember app. Query params in Ember are sticky and require knowing default values so that you properly reset them. Using the built-in query-param
helper will not remove the existing values either. This add-on makes it easier to reset and set query params. Please see the following documentation, and the live dummy app, for more examples of how these helpers can be used.
ember install ember-query-param-helpers
Note: Ember versions >= 2.4
and <2.15
also require the ember-router-service-pollyfill
ember install ember-router-service-polyfill
This dependency on the public router service is due to this addon using the router service to look up the current route.
This add-on provides the following template helpers to be used in conjunction with {{link-to}}
or {{href-to}}
.
reset-query-params
This helper allows you to reset the query params to their default values. By default it will use the current route and its hierarchy for the current query params to reset.
Note: The query params being selected by the helper must be compatible with the consuming {{link-to}}
route specified.
{{link-to "Link!" current-route" (reset-query-params)}}
####Reset whitelisted query params
{{link-to "Link!" "current-route" (reset-query-params "specificQueryParam")}}
####Reset query params for specific route
By default reset-query-params
does not know the route it is being linked to and will default to the current route. This is useful when the query params are being used for the current route's hierarchy, ie: sort
and filter
query params. In the case the link-to
is navigating to a different route and you need to reset to its default query params you can pass the route
argument.
{{link-to "Link!" "some-other-route" (reset-query-params route="some-other-route")}}
create-query-params
Similar to the regular query-params
helper but is flexible in that it can accept an object of query param key/value pairs or named arguments (similar usage to the query-params helper
). The behaviour of this helper is to only create or overwrite existing values of query params.
{{link-to "Link!" "route" (create-query-params qps)}}
Where qps
could be a reference to an object, for example:
{
sort: "DESC",
page: 5
}
####Query Params via Named Arguments
Similar to the default behaviour of query-params
:
{{link-to "Link!" "route" (create-query-params sort="DESC" page=5)}}
merge-query-params
In the case you want to combine behaviours from create-query-params
and reset-query-params
you can use merge-query-params
. This helper will merge the resulting query param operations in order, and will ensure that the returned object is compatible with what what link-to
expects. This will enable use-cases where you may want to reset all, or a specific query params, and then create, or overwrite, specific query param values.
{{link-to "Link!" parent.child"
(merge-query-params
(reset-query-params)
(create-query-params childQp="only-child-qp-is-set")
)
}}
šš I would love any ideas, fixes, features or other contributions you may have, please open an issue or pull request. You can also find me on the Ember Community Discord, under @chadian, if you would like to chat.
git clone
this repositorycd ember-query-param-helpers
npm install
npm run lint:js
npm run lint:js -- --fix
ember test
ā Runs the test suite on the current Ember versionember test --server
ā Runs the test suite in "watch mode"npm test
ā Runs ember try:each
to test your addon against multiple Ember versionsember serve
For more information on using ember-cli, visit https://ember-cli.com/.
This project is licensed under the MIT License.
FAQs
The default blueprint for ember-cli addons.
The npm package ember-query-param-helpers receives a total of 3 weekly downloads. As such, ember-query-param-helpers popularity was classified as not popular.
We found that ember-query-param-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Ā It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.