JQuery DatePicker Does Not Work With Angular JS

This took me a bit to deduce that got me confused why form.$valid always returns false even though there is already a date chosen from JQuery’s DatePicker.

The date input text field was set to required so even though I chose a date from the date picker, the value is not assigned to the ng-model of that input text field.

So it does not work with Angular JS. At least unless you do something about it. From Abequar.net, bema managed to make an Angular directive for JQuery’s date picker using this code.

And the HTML code will look something like this:

So a big thank you to bema who made it easier for developers to still use JQuery’s date picker rather than other Angular JS custom date pickers.

An important thing to note is that the Javascript libraries should be added in the following order:
1 – Jquery
2 – Jquery-ui
3 – angularjs

else, it won’t work.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *