vendredi 9 septembre 2016

Ember dependency injection not working with router

I have an ember component where I need both the store and the router. I'm trying to inject them using Ember.inject.service. It works when I inject the store, but not the router:

import Ember from 'ember';

const MyComponent = Ember.Component.extend({
  store: Ember.inject.service('store'),
  routing: Ember.inject.service('-routing'),

  classNames: ['my-component'],
  schema: Ember.computed('store', 'routing', function schema() {

    // This works. Shows up when I log it.
    const store = this.get('store');

    // This doesn't
    const routing = this.get('routing');

    // return schema from store. This works.
  }),
});

export default MyComponent

I'm on Ember version 1.11.3. Am I missing something?




Aucun commentaire:

Enregistrer un commentaire