mercredi 13 avril 2016

Get dynamic route segment in service

My ember app needs to be able to insert custom headers when retrieving data from our API. I am using ember-simple-auth and I can add these headers using a custom authorizer. Now, a new requirement has come in and I need to be able to set the header based on dynamic segments in the route.

example:

/posts/1435/comments -> will require header "Custom" to have value "1435"

/posts/2435/comments -> will require header "Custom" to have value "2435"

Is there a way to get the dynamic route segment inside of a service using EmberJS?




Aucun commentaire:

Enregistrer un commentaire