From a68cc20dd4f05e19d0790474bbf425027fd4a42f Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Mon, 13 Jun 2016 12:54:15 -0700 Subject: [PATCH] chore(dropdown): add guard when closing --- src/dropdown/dropdown.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dropdown/dropdown.js b/src/dropdown/dropdown.js index ba238b5f7c..97ce5f10d6 100644 --- a/src/dropdown/dropdown.js +++ b/src/dropdown/dropdown.js @@ -24,7 +24,10 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position']) if (openScope === dropdownScope) { openScope = null; $document.off('click', closeDropdown); - dropdownScope.getDropdownElement().off('keydown', this.keybindFilter); + var dropdownMenu = dropdownScope.getDropdownElement(); + if (dropdownMenu) { + dropdownMenu.off('keydown', this.keybindFilter); + } } };