I would like to obtain the host address of the REST adapter in a controller or in a component.
I'm using Ember-CLI, and I set up the adapter as follows:
export default DS.RESTAdapter.extend({
host: 'http://localhost:9000'
});
I am aware that this question has been asked here and here, but none of those approaches work in the recent Ember 1.6.0.
I tried all of the following:
DS.RESTAdapter.prototype.url
DS.RESTAdapter.prototype.host
App.__container__.lookup('store:main').get('adapter.url')
App.__container__.lookup('store:main').get('adapter.host')
DS.defaultStore.adapter.url
DS.defaultStore.adapter.host
Is there any way whatsoever (no matter how dirty/hacky/nauseating) to do this? Thanks!
EDIT: The correct answer is to initialize the adapter with a value you can access from elsewhere, like Kingpin2k pointed out below. I ended up creating an object with constant values and refer to it in both cases.