Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Error on item click in dropdown #2868

Closed
KhodeN opened this issue Oct 22, 2014 · 3 comments
Closed

Error on item click in dropdown #2868

KhodeN opened this issue Oct 22, 2014 · 3 comments

Comments

@KhodeN
Copy link

KhodeN commented Oct 22, 2014

Error: Uncaught TypeError: Cannot read property 'getToggleElement' of null

Code:

 var closeDropdown = function( evt ) {
    var toggleElement = openScope.getToggleElement();
    if ( evt && toggleElement && toggleElement[0].contains(evt.target) ) {
        return;
    }

    openScope.$apply(function() {
      openScope.isOpen = false;
    });
  };
@pkozlowski-opensource
Copy link
Member

Please provide a reproduce scenario as requested: https://github.com/angular-ui/bootstrap/blob/master/CONTRIBUTING.md#you-think-youve-found-a-bug

@KhodeN
Copy link
Author

KhodeN commented Oct 23, 2014

I can't reproduce this bug separately from my app.
http://plnkr.co/edit/5Gz91sNa7NHinBOPvHFb

The reason of this bug is
$document.bind('click', closeDropdown);
run handler even after
$document.unbind('click', closeDropdown); in this.close method

Later I will try again.

@KhodeN
Copy link
Author

KhodeN commented Nov 19, 2014

The bug is gone in 0.12.0. Thanks!

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

No branches or pull requests

3 participants