Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kellyselden/ember-query-params-reset
Automatically reset all query params when leaving a route
https://github.com/kellyselden/ember-query-params-reset
Last synced: 16 days ago
JSON representation
Automatically reset all query params when leaving a route
- Host: GitHub
- URL: https://github.com/kellyselden/ember-query-params-reset
- Owner: kellyselden
- License: mit
- Created: 2016-01-21T14:02:07.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-16T19:25:28.000Z (about 6 years ago)
- Last Synced: 2024-12-26T03:22:48.390Z (about 1 month ago)
- Language: JavaScript
- Size: 469 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
ember-query-params-reset
==============================================================================[![Greenkeeper badge](https://badges.greenkeeper.io/kellyselden/ember-query-params-reset.svg)](https://greenkeeper.io/)
[![npm version](https://badge.fury.io/js/ember-query-params-reset.svg)](https://badge.fury.io/js/ember-query-params-reset)
[![Build Status](https://travis-ci.org/kellyselden/ember-query-params-reset.svg?branch=master)](https://travis-ci.org/kellyselden/ember-query-params-reset)
[![Ember Version](https://img.shields.io/badge/ember-2.16%2B-brightgreen.svg)](https://www.emberjs.com/)Automatically reset all query params when leaving a route
Demo
------------------------------------------------------------------------------https://kellyselden.github.io/ember-query-params-reset
Installation
------------------------------------------------------------------------------```
ember install ember-query-params-reset
```Usage
------------------------------------------------------------------------------```js
import Ember from 'ember';
import QueryParamsResetRouteMixin from 'ember-query-params-reset/mixins/query-params-reset-route';export default Ember.Route.extend(QueryParamsResetRouteMixin, {
// the rest of your logic
});
```You can also use the util manually to reset query params at-will:
```js
import resetQueryParams from 'ember-query-params-reset/utils/reset-query-params';// ...
resetQueryParams(myRoute, ['myQueryParam']); // reset some
let defaultValues = resetQueryParams(myRoute); // reset all
console.log(defaultValues); // { myQueryParam: 'default value', /* etc... */ }
```License
------------------------------------------------------------------------------This project is licensed under the [MIT License](LICENSE.md).