How can I transition to a route and tell Ember to reload the model for that route?
My use case:
The page I am on is for an appointment
. After I cancel
the appointment I need to transition to the /schedule
route showing all the appointments except for the one I just canceled.
When I use transitionToRoute
the canceled appoitment is still in the list. I then have to reload the browser page to see the new list.
I totally agree with @Kingpin2k's suggestion in the comments of removing the appointment. If for whatever reason that doesn't work for you - just transition to the route without supplying any model (omit the 2nd parameter) or supply an id by which the model can be looked up, which is an integer or a string. The model
hook of the Route
will then be invoked.
From the docs:
If a literal is passed (such as a number or a string), it will be treated as an identifier instead. In this case, the model hook of the route will be triggered