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

TypeError: Cannot read property '$apply' of null when dropdown is closed #6225

Closed
theyiwenliu opened this issue Sep 6, 2016 · 2 comments
Closed

Comments

@theyiwenliu
Copy link

Bug description:

When dropdown is open and set auto-close to outsideClick, I am expecting the dropdown to close when I click on other elements outside of dropdown, which works for most of the case, except for clicking on "textbox"(input/textarea). It shows Uncaught TypeError: Cannot read property '$apply' of null. I have attached an example in plunker.

Link to minimally-working plunker that reproduces the issue:

https://plnkr.co/edit/YpIV2bw1kUUGs5w2yU9d?p=preview
Steps to reproduce: open dropdown -> click on textbox -> textbox is not focused and receive the error in console

Version of Angular, UIBS, and Bootstrap

Angular:
1.5.8
UIBS:
2.1.3
Bootstrap:
3.3.7

@wesleycho
Copy link
Contributor

This looks like a bug, although this doesn't really affect behavior.

https://github.com/angular-ui/bootstrap/blob/master/src/dropdown/dropdown.js#L55 should probably be changed to $rootScope.$digest().

@nherzing
Copy link
Contributor

@yiwenliuable @wesleycho I posted PR to fix this. I'm not a huge fan of the solution but the code is pretty difficult to edit without introducing other issues/accidentally changing behavior. Would love to get this (or a comparable fix) merged because we're seeing this error 10+ times a day.

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

Successfully merging a pull request may close this issue.

3 participants