Retrieve adapter properties


I was wondering how to read adapter properties on a router?

import DS from 'ember-data';

export default DS.RESTAdapter.extend({
	host: document.getElementById("rootUrl").value,
	namespace: "api"

In some cases we are not using the DS.Store but have to return JSON from an api. I’d like to be able to use the adapter properties to help generate the getJson

model: function () {
	var url = + store.namespace + 'somedata;'
	return Ember.$.getJSON(url).done(function (tree) {
		var x = tree;
		console.log("success loading org tree api data :-)");
		return tree;
	}).fail(function (jqXHR, textStatus, errorThrown) {
		alert(textStatus + ' due to:  ' + errorThrown);

I musty be over thinking this but so I have to create an instance of the store somehow in order top read these properties? I suppose I could create properties of my own but I want to do this correctly.

Thank out there… Ember Forever! :evergreen_tree:

// app/routes/index.js
const { get, $ } = Ember;

export default Ember.Route.extend({
  model() {
    // `application` here is a guess
    // perhaps you want to look up a different adapter
    const adapter = get(this, 'store').adapterFor('application');
    const url = `${get(adapter, 'host')}/${get(adapter, 'namespace')}/foobar`;

    return $.getJSON(url).done((response) => {
      // ..


awesome! but I have to learn how to make that

const { get, $ }

syntax work (still learning es6)… but this worked

	var adapter = this.get('store').adapterFor('application');
	var host = adapter.get('host');
	var np = adapter.get('namespace');

var get = Ember.get;
var $ = Ember.$;


gracious @jasonmit, that helps make things clear.