EmberJS - Query Parameters



Query parameters are specified on route driven controllers which appear to the right of the ? in a URL and are represented as optional key-value pairs.

For instance −

http://mysite.com/articles?sort=ASC&page=2 

The above URL has the two query parameters; one is sort and the other is page which contains values ASC and 2 respectively.

The following table lists down the different ways of using query parameters −

S.No. Query Parameters & Description
1 Specifying Query Parameters

You can specify the query parameters on the route-driven controllers.

2 Opting Into a Full Transition

You can use optional queryParams configuration when a controller query parameter property changes to opt into a full transition.

3 Update URL with Replacestate Instead

It prevents from adding an item to your browser's history.

4 Map a Controller's Property to a Different Query Param Key

Mapping a controller query parameter property to a different query parameter key.

5 Default Values and Deserialization

Specifying the default values to the query parameter.

6 Sticky Query Param Values

In Ember, the query parameter values are sticky by default; so that any changes made to the query parameter, the new value of query parameter will be preserved by re-entering the route.

emberjs_router.htm
Advertisements