question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

angularjs : set options not updating flatpickr element

See original GitHub issue

Expected 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:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
agauravcommented, Feb 17, 2017

So not all options can be changed by the set API after the flatpickr 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 post init.

1reaction
chmlncommented, Feb 16, 2017

@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/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - angularjs : set options not updating flatpickr element -
Calling set option from the returned Flatpickr object should update the respective element. Current Behavior. Calling set option on DOM related behaviour doesn' ......
Read more >
Options - Flatpickr
Config Option Type Default altFormat String "F j, Y" altInput Boolean false altInputClass String ""
Read more >
angularjs - select in ng-option does not update - Stack Overflow
I tried ng-selected that does not works efficiently, sometime the model is update spmetimes not. here is my code, can someone help? <div...
Read more >
angular errors when setting defaultdate on umb flatpickr date ...
The initial date of an umb-flatpickr element is set via the 'defaultDate' property of an options object. When you only have a single...
Read more >
Flatpickr appendTo - JSFiddle - Code Playground
1. // By default the calendar is appended to body, which works well because it's the topmost element ; 2. // so we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found