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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -