How can I reset sticky query params?

This question is asked very frequently in Slack #-help, so I thought I would add it here.

Currently the best, addon-free method is to use the resetController hook in the route. There’s more on this in the guide plus example code, but it’s often missed: Query Parameters - Routing - Ember Guides.

For more complex use-cases, you may want to try using GitHub - offirgolan/ember-parachute: Improved Query Params for Ember.

Example code in case that link becomes unreachable:

import Route from '@ember/routing/route';

export default Route.extend({
  resetController(controller, isExiting, transition) {
    if (isExiting) {
      // isExiting would be false if only the route's model was changing
      controller.set('page', 1);
    }
  }
});