Open jacek213 opened 8 years ago
If anyone is facing the same issue, here is my workaround (based on solution for core materialize lib - https://github.com/Dogfalo/materialize/issues/870#issuecomment-168944579):
(function() {
'use strict';
angular
.module('myappmodule')
.directive('inputDate', inputDate);
// this decorator enables new option: closeOnSelect -> false by default
/** @ngInject */
function inputDate() {
var directive = {
link: link
};
return directive;
function link(scope, elem, attrs) {
if (attrs.closeOnSelect) {
elem.pickadate({
onSet: function(arg){
if ('select' in arg){ //prevent closing on selecting month/year
this.close();
}
}
});
}
}
}
})();
Please see this PR: Dogfalo/materialize#4003 that shows how to fix without the hacky workaround.
I think we'll wait and see if Dogfalo/materialize#4003 gets merged, and if it does, then that makes our implementation much easier.
Until then, others can use the workaround.
As stated in the title. I'm aware that it's the default behaviour of
pickadate
provided by materialize and I know it can be hacked by closing it inonSet
function with jquery, but it would be nice if it was configurable option, especially considering the fact that that's the way the "clean"pickadate
works by default.