Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoclose #72

Closed
Opa- opened this issue Nov 26, 2014 · 8 comments
Closed

Autoclose #72

Opa- opened this issue Nov 26, 2014 · 8 comments

Comments

@Opa-
Copy link

Opa- commented Nov 26, 2014

Autoclose of the datepicker when selecting a value on the min-view would be very appreciated 👍

@NickLarsenNZ
Copy link

I modified the dist/index.js so that when the data is entered into the model (ie: on the final view), the popup closes (using Jquery): Here's my diff:

--- client/js/index.js  2014-12-06 11:41:27.000000000 +1300
+++ /Users/nick/Downloads/angular-datepicker-master/dist/index.js       2014-11-25 03:59:18.000000000 +1300
@@ -215,12 +215,10 @@
             scope.model.setFullYear(date.getFullYear());
           }
           scope.$emit('setDate', scope.model, scope.view);
-        } 
+        }

         if (nextView) {
           scope.setView(nextView);
-        } else {              
-          $('.dropdown-toggle').parent().removeClass('open'); // Nick: This is where we should close the popup
         }
       };

@dnlmzw
Copy link

dnlmzw commented Jan 29, 2015

+1 to that.

@dnlmzw
Copy link

dnlmzw commented Jan 29, 2015

Alternatively to:

$('.dropdown-toggle').parent().removeClass('open');

If you don't want to point to a specific element, you can replace it with:

setTimeout(function(){ scope.$emit('$destroy'); }, 1);

Or (only when used with input fields):

$(':focus').blur();

@eralha
Copy link
Collaborator

eralha commented Feb 11, 2015

I think this should be optional, like a flag on the date-picker directive like "<... auto-close='true' />"

@pkalkman
Copy link

pkalkman commented Mar 4, 2015

I agree with @eralha. In mine opinion that's a big +1

Any plans for implementing that

@eralha
Copy link
Collaborator

eralha commented Mar 4, 2015

I can implement that, i just need to give it a little more thinking, because you can manage the visibility of the datepicker with so many things for exp: ng-class, ng-visible etc... i need to see if the implementation doesn´t clash with any functionality

@patricktargun
Copy link

Yes, please add 👍

eralha added a commit that referenced this issue Mar 9, 2015
@eralha
Copy link
Collaborator

eralha commented Mar 9, 2015

Closed, you can set the attribute auto-close="true" to use this feature.

@eralha eralha closed this as completed Mar 9, 2015
eralha added a commit that referenced this issue Mar 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants