Chosen doesn't update when the model changes programmatically
See original GitHub issueIf you are going to be lazy asking me properly, I’ll be lazy answering to you (@leocaseiro)
Please make sure you can mark all the options, before open this Issue. I’ll prioritise the issues that are consistent and completed.
- I’ve read the documentation on http://leocaseiro.github.io/angular-chosen.
- I’ve searched on github issues and stackoverflow before open this issue.
- I’ve tested with the angular native select input without the chosen directive
- I’ve tested with the oficial jquery chosen without the angular chosen directive
Please, post your plunker link here:
Write your issue:
As can be seen in the attached plunker, clicking the button, which updates the model value, does not result in chosen itself getting re-rendered.
This seems to be because of this line in the code. At least when I’m looking at it, the .css()
call always returns a value of 0px
, even when the dropdown is closed, which prevents the updated event from getting triggered.
I have no problem creating a PR, but I’m just not sure what that line of code is trying to accomplish. Would it be enough to test whether the dropdown is open (e.g. by checking if the active class is applied)?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
angularjs - Select box not updating when model is changed ...
If you change the value of the select using the JQuery function ( .option() ) for selectmenu , it updates the select box...
Read more >SCR19: Using an onchange event on a select element ... - W3C
The objective of this technique is to demonstrate how to correctly use an onchange event with a select element to update other elements...
Read more >select - API Reference - Kendo UI DropDownList
The model bound to the widget will not be updated. You can overcome this behavior trigerring the change event manually using trigger("change") method....
Read more >Modifying a stack template - AWS CloudFormation
If your template includes an unsupported change, AWS CloudFormation returns a message saying that the change isn't permitted. This message might occur ...
Read more >Programmatic Modeling Basics - MATLAB & Simulink
Loading a model brings it into memory but does not open it in the Simulink Editor for editing. After you load a model,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Opened pull request #245 will appreciate feedback
My intuition is that we should remove the overwritten
ngModel.render
and the CSS hack and instead add something like:The idea is that formatters are called only when angular changes the expression, while
ngModelCtrl.render()
is called both when angular chances it, and when chosen changes itThis is just a guess off the top of my head, haven’t had the chance to think through it very deeply.