databind icon indicating copy to clipboard operation
databind copied to clipboard

Changing model from javascript

Open FilipN opened this issue 9 years ago • 4 comments

Hello, I understand the binding where when I change the DOM element value it changes the model. But when I change the model from some other javascript function, it doesn't trigger update on the element that is binded to it. Is there a way that I can change model directly and expect automatic update on the element? Thanks in advance

FilipN avatar Jan 20 '16 14:01 FilipN

@FilipN what data type are you trying to change? how did you bind to it? You can see in the live example code various examples of 2-way binding: http://codepen.io/grnadav/pen/ptJKg

grnadav avatar Jan 20 '16 15:01 grnadav

@grnadav I am trying to implement "change language" feature. My model holds "selectedLanguage" which is binded to a

FilipN avatar Jan 20 '16 15:01 FilipN

@grnadav I think the issue is, when i change model from some javascript code and not trough binding it doesn't trigger action to change bonded elements. Previous post was too project specific.

FilipN avatar Jan 21 '16 07:01 FilipN

@FilipN do you mind putting down a demo gist / codepen with example? I'm not 100% sure I understand what you mean...

grnadav avatar Jan 23 '16 20:01 grnadav