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;
}
}
Author by
eguneys
Updated on July 04, 2022Comments
-
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 over 9 yearsWhat about a specific route within Ember.route, instead of a transition to that route, i need a reload to that route.
-
Mike Cluck over 9 yearsIf you know the route then just do
window.location.href = route
-
BillPull over 8 yearsthis may be correct in older versions but currently
transition.targetName
is not the path. So if you had nested routes likestore/info
thetargetName
would bestore.info