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);
}
}
});
Your code looks okay. If you really want to change something you could make foo
method an action:
Ember.Component.extend({
...
actions: {
bar() {
this.send('foo', this.get('val'));
// .. other code
},
foo(val) {
this.set('baz', val);
}
}
});