jeudi 24 août 2017

Access a ember service from mirage config.js

How can I access an ember service from within mirage config.js? I tried 2 ways, but both are not working:

Try 1:

// mirage/config.js
export default function() {
  this.get('/post', function(schema, request) {

    let mystore = Ember.inject.service('mystore');

    // ..
  });
}

Try 2:

// mirage/config.js
export default function() {
  this.get('/post', function(schema, request) {

    let mystore = Ember.computed(function() {
      return Ember.getOwner(this).lookup('service:mystore');
    });

    // ..
  });
}




Aucun commentaire:

Enregistrer un commentaire