dimanche 2 août 2015

Observe value of input component

I have a simple component that is a input element via the tagName.

So far no problem. Now I would like to observe the value attribute of the input. Anytime the input is changed I would like to fire an observer.

Why does this not work?

A JSFiddle can be found here.

<script type="text/x-handlebars">
    {{my-input}}
</script>

<script type="text/x-handlebars" id="components/my-input">
</script>

var App = Ember.Application.create();

App.MyInputComponent = Ember.Component.extend({
    tagName: 'input',
    attributeBinding: ['value'],
    onChange: Ember.observer('value', function() {
        console.log('change');
    })
});




Aucun commentaire:

Enregistrer un commentaire