1.13 input mut value observable/update


#1

JSBin here

Why is the value bound by HTML input not updated? Where as with emer input helper value is updated and observer is fired. I thought using mut should do the trick.

Thanks


#2

I could be wrong about this since I haven’t been keeping up to date for the last month but I don’t think angle bracket components are supported until 2.0.


#3

Something like this will work. Input is just the DOM element, it’s not an ember component so it’s not calling set on the target value. If you really want to use the DOM’s Input then you need to bind an action to the oninput

Edit: updated with the correct jsbin URL


#4

@jasonmit Thanks, that works. Although what i did was, extended Ember.TextField like

App.FpInputComponent = Ember.TextField.extend({
click: function(args){
    var clickAction = this.getAttr('inClick')
    if(clickAction)
        this.sendAction('inClick', args);
}});

and used like

    {{fp-input value=content  inClick='inputClicked'}}

and the observer fire fine when content is changed.

Any preference for either one?

Thanks!


#5

I would use actions. They’re more explicit and easier to understand the flow and inline with data down, actions up versus mutating objects through the use of an observer pattern. Can easily find yourself in an entangled mess.