lundi 27 juin 2016

Ember js: TypeError: this.store.adapterFor is not a function inside component

So I have different host url for production and development

I am trying to make a ajax post call inside a component, I have this to get the host from the store:

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

I have injected the dependency with this:

import Ember from 'ember';

export default Ember.Component.extend({
   store: Ember.inject.service(),

but I get this error

TypeError: this.store.adapterFor is not a function

Any help will be appreciated.

also here is my adapters/application.js

import DS from 'ember-data';
import ENV from "../config/environment";

export default DS.JSONAPIAdapter.extend({
    host: ENV.APP.API_HOST,
});




Aucun commentaire:

Enregistrer un commentaire