lundi 29 mai 2017

EmberJS : Call parent class function from child class init method

I have a parent class

MyBaseClass = Ember.Object.extend({
  getData:function() {
    return someData;
  }
})

and a child class that when created needs to call a function in parent class

MyChildClass = MyBaseClass.extend({
  sampleData:[],
  init:function(){
    Ember.set(this, 'sampleData', this.getData());
  }
})

My problem is, when i run this code i get "Uncaught TypeError: this.getData is not a function".

Any idea why this is happening? Or fix to this.




Aucun commentaire:

Enregistrer un commentaire