dimanche 8 novembre 2015

Ember "this" undefined in component

I have injected a service and I'm trying to create a computed property from a property of the service. However, this is always undefined unless in debugging.

import Ember from 'ember';

export default Ember.Component.extend({
  progress: 0,
  game: Ember.inject.service(),
  events: this.get("game.challenges")
});

How can this be undefined in the above code?

I've thrown in a debugger like this:

init() {
  debugger
},

If I log out this.get("game") it returns the expected value.

I've always tried putting in the service inside of the init, still undefined.




Aucun commentaire:

Enregistrer un commentaire