angularjs : set options not updating flatpickr element
See original GitHub issueExpected Behavior
Calling set option from the returned Flatpickr object should update the respective element.
Current Behavior
Calling set option on DOM related behaviour doesn’t seem to work for the angular directive e.g.
fpObject.set('clickOpens', false);
fpObject.set('prevArrow', '<<');.
fpObject.set("minDate", new Date());
seems to work as expected
The config properties are getting updated in the flatpickr object but it doesn’t seem to reflect in the html. Even enforcing a redraw has no effect.
Steps to Reproduce (for bugs)
This pen demonstrate the above behaviour https://codepen.io/opavader/pen/jyyLVq?editors=1010
- angularjs v1.5.8
- flatpickr : 2.3.5
I maintain the angualr-flatpickr module and it was reported by one of its user https://github.com/archsaber/angular-flatpickr/issues/8 . I am not really proficient in either angular or javascript so was hoping anyone of the flatpickr authors will be able to help.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
So not all options can be changed by the
set
API after theflatpickr
object has been created? It will be really helpful if a label can be added in the new docs to the options list denoting which are configurable postinit
.@neokio event hooks get converted to arrays only when flatpickr is initialized. There isn’t a detector of a hook in
set
.At https://github.com/chmln/flatpickr/blob/master/src/flatpickr.js#L1634-L1639 it can’t loop over a function. If you pass in an array, it works fine however.
See https://jsfiddle.net/vj8a7eoh/