vendredi 23 janvier 2015

Ember action on='change' event

I have this ember action helper (which is just for experimenting)



{{input type='number' action='calculateMph' on='change'}} mph = {{controller.mph}} km/h


If I remove the on='change' it works fine when I press enter. But with on='change' it simply doesn't work at all. And the debugger isn't giving me anyting.


Am I doing something wrong? I want the action to run as you type into the input field and update the value live.


Here's my controller if it's any help.



var HomeController = Ember.Controller.extend({
mph: null,

actions: {
calculateMph: function(parameter) {
var result = parameter * 1.60934
this.set('mph', result);
}
}
});


Note that I'm using ember CLI





Aucun commentaire:

Enregistrer un commentaire