Skip to content

Commit

Permalink
Fix #244 ng-model sync
Browse files Browse the repository at this point in the history
Doing so while preserving the workaround for #59
  • Loading branch information
abyx committed Jul 20, 2017
1 parent 7f2f507 commit eef6b3c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dist/angular-chosen.js
Expand Up @@ -87,8 +87,8 @@
initOrUpdate = function() {
var defaultText, dropListDom;
if (chosen) {
dropListDom = $(element.parent()).find("div.chosen-drop");
if (dropListDom && dropListDom.length > 0 && parseInt(dropListDom.css("left")) >= 0) {
dropListDom = $(element.next('.chosen-with-drop'));
if (dropListDom && dropListDom.length > 0) {
return;
}
return element.trigger('chosen:updated');
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-chosen.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/chosen.coffee
Expand Up @@ -94,10 +94,10 @@ chosenModule.directive 'chosen', ['chosen', '$timeout', (config, $timeout) ->
initOrUpdate = ->
if chosen
# Fix #56 Don't scroll to top when selecting multiple items with ctrl
dropListDom = $(element.parent()).find("div.chosen-drop") #uses jQuery instead of Angular.
if dropListDom && dropListDom.length > 0 && parseInt(dropListDom.css("left")) >= 0
dropListDom = $(element.next('.chosen-with-drop')) #uses jQuery instead of Angular.
if dropListDom && dropListDom.length > 0
return
return element.trigger('chosen:updated')
element.trigger('chosen:updated')
else
scope.$evalAsync ->
chosen = element.chosen(options).data('chosen')
Expand Down
1 change: 1 addition & 0 deletions test/base.spec.js
Expand Up @@ -11,6 +11,7 @@ describe('base functionality', function() {
$scope.$digest();
$timeout.flush();
element.trigger('chosen:open.chosen'); // fills dropdown (triggers chosen:showing_dropdown when finished)
element.trigger('chosen:close.chosen');
});

it('should add chosen dropdown', function() {
Expand Down

0 comments on commit eef6b3c

Please sign in to comment.