I'm using Ember v 1.13.8
I have input helper:
{{input type="text" value=newData action="addNewItem"}}
and action handler:
actions: {
addNewItem: function(value) {
this.get('personList').pushObject({name: value});
this.set('newData', '');
}
}
As you can see in order to clear input I have variable in controller where I store temporary value. I made input
helper dependent on it and this approach works, but I wonder may be there is Ember way of doing this?
Your approach is correct. The only more Ember way I can see is using new JavaScript syntax when declaring function:
actions: {
addNewItem(value) {
this.get('personList').pushObject({name: value});
this.set('newData', '');
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With