Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upfeat(dropdown): Make Auto-Close Dropdowns optional. Fix #2218 #3045
Conversation
asafdav
commented
Jan 16, 2015
|
+1 |
|
@chrisirhc I noticed you mentioned in #2218 about being willing to review a PR if someone implements the feature. This PR looks pretty good to me, but I'd like a second pair of eyes since I'm too tired at the moment. That this is an optional feature makes this ok IMO. |
| @@ -2,3 +2,7 @@ | |||
| Dropdown is a simple directive which will toggle a dropdown menu on click or programmatically. | |||
| You can either use `is-open` to toggle or add inside a `<a dropdown-toggle>` element to toggle it when is clicked. | |||
| There is also the `on-toggle(open)` optional expression fired when dropdown changes state. | |||
| By default the dropdown will automatically close if any of its elements it's clicked, you can change this behaviour by setting the `auto-close` option as follows: | |||
This comment has been minimized.
This comment has been minimized.
| @@ -2,3 +2,7 @@ | |||
| Dropdown is a simple directive which will toggle a dropdown menu on click or programmatically. | |||
| You can either use `is-open` to toggle or add inside a `<a dropdown-toggle>` element to toggle it when is clicked. | |||
| There is also the `on-toggle(open)` optional expression fired when dropdown changes state. | |||
| By default the dropdown will automatically close if any of its elements it's clicked, you can change this behaviour by setting the `auto-close` option as follows: | |||
|
|
|||
| * `outsideClick` - closes the dropdown automatically only when the user clicks any element outside the dropdown. | |||
This comment has been minimized.
This comment has been minimized.
| @@ -85,6 +93,14 @@ angular.module('ui.bootstrap.dropdown', []) | |||
| return self.toggleElement; | |||
| }; | |||
|
|
|||
| scope.getAutoClose = function() { | |||
| return autoClose; | |||
This comment has been minimized.
This comment has been minimized.
chrisirhc
Mar 27, 2015
Member
Can just return $attrs.autoClose here. This will allow support for dynamic autoClose (auto-close="{{ myAutoClose}}"). Though unlikely to be useful, as in most cases this will be a constant, we can save a variable and add support for that.
|
Great work. I did a review. This looks good. Just a few suggestions. |
|
I'll make the edits as soon as I have 5 minutes. Thanks for reviewing! |
|
@chrisirhc Merged with upstream and addressed all the comments. |
|
Can you clean up the history? The merge commit should not be there. |
|
Done (and merged with latest commits) |
|
Thanks for the work here, this will make it in 0.13.0! |
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
Fixes angular-ui#2218 Closes angular-ui#3045
mariocasciaro commentedDec 3, 2014
Introduces an
auto-closeoption which - when specified - works as follows:outsideClick- closes the dropdown automatically only when the user clicks any element outside the dropdown.disabled- disables the auto close. You can then control the open/close status of the dropdown manually, by usingis-open.