How to reload route after saving data?

I have this preparation/controller.js

action: {
           ad.set('wfnum', i);
           ad.save().then(
           function () {
              return true;
           },
           function () {
              if(ad.get('hasDirtyAttributes')) {
                 ad.rollbackAttributes();
              },
         };

Then in another route named approval/route.js

@task(function* () {
  try {
       let ad = yield this.modelFor('.....').ad;
       let approval = yield this.store.query('approval', {
        'ad': ad.id
       })

      return {
           ad: ad,
           adapproval: adapproval,
         }
      } catch(e) {
        throw (e);
        }
    })

So after i saving the ad in the preparation/controller.js, i navigate to other page which need to called the approval/route.js. The approval/route.js the ad model wouldn’t get the latest data updated unless i refresh the page. So how am i going to refresh the route after i saving the data? I did use refresh / reload but it seems not working

Does Ember.Controller.replaceRoute Controller - 3.26 - Ember API Documentation work?

/or Ember.Controller.transitionToRoute ( I didn’t see it in 3.26)

Have you tried just calling ad.reload() after this line? That will reload the ad record.

1 Like