Many search variables in model (length of the url)


I’ve created a travel site in ember, and as you can imagine there are quite a few search options, next to pagination.

At the moment if search options (location, type of location, facilities, sorting, etc) are updated I fetch a new array of models in the controller. Main downside of that for me is that I don’t have the loading route, so there is no visual feedback to the user that new data is being fetched.

If I want to do it via the route I would need to add all the necesaary options to the url, as otherwise the router sees no model change and won’t fetch new data. Putting all the options in the url however would result in a huge url, that is not very nice.

Any suggestions on the best way to handle this?


Just for history … I had such a problem.

Finally I did change http request method to POST and sent search parameters as request body.

  1. You can use something like ember-fetch to make a POST request and get data back (but you’ll need to make them Models if you use ember data)

  2. If you use Ember Data: create model specific adapter and override ajaxOptions and\or urlForQuery (if needed).

e.g. (simplified example):

import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({

  ajaxOptions(url, type, options) {
    type = 'POST';
    let hash = this._super(url, type, options);
    return hash


And options will go to POST’s body