Setting angular-chosen directive ng-model attribute from a controller function, angular-chosen does not update it.
See original GitHub issueHello Leo, angular-chosen directive is a time saving piece of code, obrigado thanks.
I’ve run into an issue when moving from v1.3.0 to v1.5.0;
Setting chosen directive ng-model
attribute from a ctlr function, angular-chosen does not update it.
because initOrUpdate
function returns before it reaches element.trigger('chosen:updated')
.
After some inspection, commenting the return statement, made it work.
if (dropListDom && dropListDom.length > 0 && dropListDom.css("left").indexOf("0") >= 0)
{ //return; /*commented to test*/}
return element.trigger('chosen:updated');
However, console.log shows me both approaches (via chosen or via function) enters the condition, so the root cause it’s not the return statement. The fact is that via function, the dropListDom.css
do not receive de .ng-valid-parse class
. Maybe this is the reason, but my skills cannot ensure that. And also I don’t know why, when using the fn, the directive updates twice.
Thank you, valeu! -egidio
chosen 1.6.2 / angular-chosen v1.5.0
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:26 (14 by maintainers)
Top GitHub Comments
What works for me was: NOTE: I tried a custom selected variable, nop, it does not work but the convention is all right.
and in the view
and it works quite great! @leocaseiro thanks, carnal!!!
Just an update that any better fix to avoid the scroll go to the top will be accepted as a PR.
PS: I’m also planning to implement a kind of emit call for
chosen:update
. Probably will work on that this weekend. (If I have time to do so).