Combo (get and set Values) and Angular

I need init Combo in Directive. I can have any count of Combo. ANY. And all of them must change value when I changed value in some Combo.
I coded Init.
I use getComboText()
I don’t know to set this value (ComboText) to all other Combo’s.

example → plunker

I added

var combo_inputs = document.getElementsByClassName('dhx_combo_input'); for (var i = 1; i <= combo_inputs.length; i++) { combo_inputs[i-1].value="ghghhg";} });

in
z.attachEvent(“onChange”, function()…

It works. But doesmore optimal choice exist?

Here is how you can apply selected value for all combos:
plnkr.co/edit/fzchvU5rIeGmBnx50M85?p=preview

Forgot to mention. We made an important change in your code: replaced ‘scope: true’ with ‘scope: false’, because value variable must be contained within same function’s scope.

Thanks.
I need scope: true to count index.

Which are the best way to add class for combo (hidden input) in Angular?

I use

var st = document.getElementsByClassName('dhx_combo_input');	
for (var i = 0; i <= st.length-1; i++) 
   st[i].classList.add("class_blue");

I would like to do it more dynamically.

Darya
Thanks. But I have error with new code.

Error: $digest already in progress

Just need add if(!scope.$$phase) before scope.$apply();

Not sure about Angular… But you can redefine .dhx_combo_input{} rule in css. Or if you want to apply className dynamically, add it via private js property DOMelem_input
I.e.

combo.DOMelem_input.className += "class_blue";

Yes. It’s works. But

combo.DOMelem_input.style.opacity = "0";

or

combo.DOMelem_input.style.display = "none";

doesn’t work.

And about first question.
You typed only for “onChange”.
I copy this code to “onKeyPressed”. It doesn’t work)

I must use

DOMelem.style.opacity = "0";

instead of

DOMelem_input.style.opacity = "0";

Then it works.

And about first question.
You typed only for “onChange”.
I copy this code to “onKeyPressed”. It doesn’t work)

Hello,

when you are typing in combo input, the selected value is not changed. Therefore, you should use getComboText()/setComboText(text) methods.

Again this task) All inputs MUST have same value ALWAYS

It works if I use version 3.*
version 3.* - works

But it doesn’t work in 4.0.3
version 4.* - doesn’t work

When I added z._checkForMatch(); after z.setComboText(value);
it began work.
24 hours did it

Is it really 4.* behavior is different from 3.* version? Problems with my task remain as it comes :smiley:

Please try to use setComboValue instead of setComboText