Sha256: 6e71572701d0e7f7d7032a753b92be3c9721145cdb96032180d8c7d575aea62a

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

/**
@module ember
*/
import { assert } from '@ember/debug';
import { assign } from '@ember/polyfills';
import { QueryParams } from 'ember-routing';
import { InternalHelperReference } from '../utils/references';
/**
  This is a helper to be used in conjunction with the link-to helper.
  It will supply url query parameters to the target route.

  Example

  ```handlebars
  {{#link-to 'posts' (query-params direction="asc")}}Sort{{/link-to}}
  ```

  @method query-params
  @for Ember.Templates.helpers
  @param {Object} hash takes a hash of query parameters
  @return {Object} A `QueryParams` object for `{{link-to}}`
  @public
*/
function queryParams({ positional, named }) {
    // tslint:disable-next-line:max-line-length
    assert("The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName='foo') as opposed to just (query-params 'foo')", positional.value().length === 0);
    return new QueryParams(assign({}, named.value()));
}
export default function (_vm, args) {
    return new InternalHelperReference(queryParams, args.capture());
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-glimmer/lib/helpers/query-param.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-glimmer/lib/helpers/query-param.js