How to reload page in Ember or Jquery

10,729

Solution 1

This should do the trick:

window.location.reload(true);

Solution 2

So according to you guys I've solved my both problems as follows, acknowledge if this is the proper way to do this.

In controller i refresh the page:

window.location.reload(true);

In route i transition to specific route:

actions: {
    willTransition: function(transition, route) {
        transition.abort();

        window.location.href = '/' + transition.targetName;
    }
}
Share:
10,729
eguneys
Author by

eguneys

Updated on July 04, 2022

Comments

  • eguneys
    eguneys almost 2 years

    How can i force a reload instead of a transition in Ember.Route

    For example inside this function:

    File: play_route.js

    actions: {
        willTransition: function(transition, route) {
            transition.abort();
            transition.refresh();
            // maybe
            // window.location.href = route;
        }
    }
    

    How can i force a reload inside Ember.Controller

    For example inside this function:

    File: play_controller.js

    actions: {
        reloadPage: function() {
            // reload baby
        }
    }
    
  • eguneys
    eguneys over 9 years
    What about a specific route within Ember.route, instead of a transition to that route, i need a reload to that route.
  • Mike Cluck
    Mike Cluck over 9 years
    If you know the route then just do window.location.href = route
  • BillPull
    BillPull over 8 years
    this may be correct in older versions but currently transition.targetName is not the path. So if you had nested routes like store/info the targetName would be store.info