mercredi 10 mai 2017

Emberjs - Getting full URL of target route in AfterModel hook

I would like to be able to attach certain model relative meta tags inside a page that the user travels to and one of those meta tags needs to contain the full URL of the respective page.

Suppose I start on page http://ift.tt/2qT9ceZ and click on a link that takes me to http://ift.tt/2pwx5o0. I want to know if it's possible to get that full url to /x/y/z in the afterModel hook of model z's route file (since I also need access to the model) where z is it's own component with a controller, route and template.

I have tried to use things along the lines of this.get('router.location.location.href') in the afterModel hook of z's route file but that returns the full url to /x/y not the intended /x/y/z. I'm assuming that happens because Ember hasn't finished updating the location, but i'm not sure how to get around it.




Aucun commentaire:

Enregistrer un commentaire