vendredi 5 février 2016

Avoid repetition of method name in actions

How do I avoid the following repetition of my foo method in my ember component?

Ember.Component.extend({
  ...

  foo(val) {
    this.set('baz', val);
  },

  actions: {
    bar() {
      this.foo(this.get('val'));

      // .. other code
    },
    foo(val) {
      this.foo(val);
    }
  }
});

Aucun commentaire:

Enregistrer un commentaire