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 parameter; 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
1Specifying Query Parameters
You can specify the query parameters on the route-driven controllers.
2Opting Into a Full Transition
You can use optional queryParams configuration when a controller query parameter property changes to opt into a full transition.
3Update URL with Replacestate Instead
It prevents from adding an item to your browser’s history.
4Map a Controller’s Property to a Different Query Param Key
Mapping a controller query parameter property to a different query parameter key.
5Default Values and Deserialization
Specifying the default values to the query parameter.
6Sticky 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.

Previous Page:-Click Here

This Post Has 2 Comments

Leave a Reply