Prevent URL Change


#1

Hello,

I am rather new to Ember and I am currently building an app with version 2.1. As part of the app, pagination is required, so each time I press a button to show more I query the backend API and return the next set of results. When this process is performed the URL is updated with the query parameters (which is as expected.). Unfortunatley I don’t want the URL to be updated at all during this process. Is this beyond the scope of Ember? Does the URL always have to be updated for the router to work?

Any help would be greatly appreciated.


#2

Take a look here:

http://emberjs.com/api/classes/Ember.Route.html#property_queryParams

When setting up your queryParams in the route, you can setup some options for each parameters. By setting “replace : true” the url will still change, but you will not get an additional url in your history which I assume you want to achieve.

If you don’t want the url to change at all, you shouldn’t be using a query parameter.


#3

FYI, there is a known bug with using both the replace and refreshModel Query Param options at the same time. I think this is your solution, but doesn’t work properly ATM.