mercredi 4 novembre 2015

In Ember.js, how to use parent model's functions

I have two models:

Parent = Ember.Model.extend({
  hello: function() {
    console.log("parent says hello");
  },
  world: function() {
    console.log("parent says world");
  }
});
Child = Ember.Model.extend(Parent, {
  hello: function() {
    console.log("child says hello");
    // how do I call Parent.hello here?
    // how do I call Parent.world here?
  }
});

I want to call the Parent.hello and Parent.world functions from within the Child.hello function.

How would I go about doing this? Is there a super method I can use or do I just use bind and reference the Parent model class within the Child.hello function?




Aucun commentaire:

Enregistrer un commentaire