How to reload models and also reset query params on leaving page?


#1

How do you reload your models while also resetting query parameters when leaving the current page?

For example, I have:

  resetController: function(controller, isExiting, transition) {
    alert('Exiting');
    if (isExiting) {
      controller.set('user_stats_date', null);
    }
  },

  actions: {
    submitAction: function() {
      console.log('Reloading models');
      this.refresh();
    }

},

The resetController will erase the controller values so they don’t persist after leaving the page. submitAction relies on calling refresh() to reload the models on my page.

However, refresh will also call the resetController which causes my values to get wiped. What is a good way to accomplish both of these functions.

Thanks!