amiel / ember-data-url-templates

an ember-addon to allow building urls with url templates instead of defining buildURL
https://github.com/amiel/ember-data-url-templates/wiki
MIT License
129 stars 22 forks source link

Can I inject i18n in my adapters? #20

Closed jobsboris27 closed 8 years ago

jobsboris27 commented 8 years ago

I want to inject i18n in adapter for changing my namespace.

namespace: `someApi/someUrl/${this.get('i18n.locale')}`
amiel commented 8 years ago

Yep, you would want to do something like this:

urlTemplate: 'http://example.com/someApi/someUrl/{locale}/whatever',
i18n: inject.service(),

urlSegments: {
  locale() {
    return this.get('i18n.locale');
  },
}