lundi 20 février 2017

Ember JS: Mapping 3 input in a component to one value

I am working on a component for entering a date, the component will have 3 separate input fields (date, month, year) but I would like concatenate the value of each fields into a formatted value (ex 2017-01-02) that I would bind to my model.

I am using an observer to this so if any of input change I update the formatted value. I also have an observer that listen to when the formatted changed, I update the 3 fields.

The problem seem to be when I changed the formatted value, one observer kicks in, I set the value for 3 fields, then I another observer kicks in, then formatted value kicks in, etc.

I am wondering is there easier way to accomplish this?




Aucun commentaire:

Enregistrer un commentaire