I wrote a function inside one of my Ember models that's designed to set some properties on the model instance. Below is a gross over-simplification of what the function is trying to do.
// In widget.js
export default DS.Model.extend({
...
turnOn() {
this.set('enabled', true);
}
});
I come from a Ruby background, so something like this feels very natural and appropriate, but I can't seem to access the model instance from within the turnOn()
function. Am I doing something wrong? Is there a more appropriate way to accomplish what I'm trying to do?
Aucun commentaire:
Enregistrer un commentaire