ember.js - Avoid repetition of method name in actions -
how avoid following repetition of foo method in 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); } } });
your code looks okay. if want change make foo
method action:
ember.component.extend({ ... actions: { bar() { this.send('foo', this.get('val')); // .. other code }, foo(val) { this.set('baz', val); } } });
Comments
Post a Comment