vendredi 23 décembre 2016

Ember unknown injection ajax

i'm using ajax in my ember app as follows (component):

ajax: Ember.inject.service(),

  ajaxRequest(method, href, type, json,callback) {
    let ajax = this.get('ajax');
    let promise = ajax.request(href, {
      method: 'POST',
      data:  json
    });
    promise.then(() => {
     callback();
    }).catch((e) => {
     console.log(e);
   });},

But i get :

ember.debug.js:2307 Uncaught Error: Attempting to inject an unknown injection: 'service:api'

DEBUG: 
-------------------------------
Ember      : 2.9.1
Ember Data : 2.10.0
jQuery     : 3.1.1
-------------------------------




Aucun commentaire:

Enregistrer un commentaire