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
}
}
To refresh your ember model you can use this. refresh(); . Actions should be on controller not on route accordingly to last RFC discussion about route-action helper. I would recommend to move the refreshModel() action to controller.
You can use the location. reload() JavaScript method to reload the current URL. This method functions similarly to the browser's Refresh button. The reload() method is the main method responsible for page reloading.
The location. reload() method reloads the current URL, like the Refresh button.
Definition and Usage. The reload() method reloads the current document. The reload() method does the same as the reload button in your browser.
This should do the trick:
window.location.reload(true);
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;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With