Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

On collection change update position of upward dropdown (fixes #1167) #1168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Aug 28, 2015

Hi,

This commit should fix issue #1167.

@grahamlittle
Copy link

hi,
i am sorry if i am asking stupid question but, issue says Open so does this mean it has not yet been merged into a release?
Many thanks

element.addClass(directionUpClassName);
// Reposition upward dropdown each time the collection of items changes
scope.$watchCollection('$select.items', function() {
$timeout(repositionUpwardDropdown);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a big optimization that can be done here. Instead of doing a $timeout everytime it changes, scheduling an operation with scope.$$postDigest would batch it. This requires the addition of a boolean check inside the $watchCollection callback, and resetting the flag when the function is executed.

Something like

var foo = false;
scope.$watchCollection('$select.items', function() {
  if (!foo) {
    scope.$$postDigest(function() {
      foo = false;
      repositionUpwardDropdown();
    });
  }
});

@wesleycho
Copy link
Contributor

This needs rebasing.

This should fix #1007.

@longzheng
Copy link

+1 vote for this to be fixed too

@tbugge-amplero
Copy link

  • 1 this has been an issue for us for quite a while!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants