2

How to get jquery ui date picker working with angular2?

I'm using angular2 and typescript with html5.

I'm trying to add the jquery ui datepicker.

I have all the librarys and the css added but the datepicker jquery code is wiring up to the html.

lib: https://jqueryui.com/datepicker/

Heres my code:

  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>

  <p>Date: <input type="text" id="datepicker"></p>

I've tried putting this in my component : $( "#datepicker" ).datepicker(); But I just get errors.

any ideas?

I get this error when I add the project to mine:

enter image description here

3
  • I just couldnt get the datepicker work in an angular 2 environment Commented Jan 29, 2016 at 16:57
  • it didnt like the $ in the component Commented Jan 29, 2016 at 16:57
  • PrimeNG will provide a datepicker very soon according to their roadmap. blog.primefaces.org/?p=3763 Commented Feb 1, 2016 at 10:18

4 Answers 4

1

Well there are already many datepicker libraries available for the angular2. few of them i have posted below:

but yes obviously everyone need stylish datepicker for our project me too want same so i according to need i have created one datepicker using bootflat framework for styling. you can refer here..

https://github.com/MrPardeep/Angular2-DatePicker

hope this may help you !

enter image description here

Sign up to request clarification or add additional context in comments.

9 Comments

sorry but this referred repo is working fine for me...btw whats the error you have ?
Which one of the three links above did you try?
does it work in internet explorer? because the documentation says chrome and firefox
i have't tested on IE you can test. i am not sure about this
is there a demo link? so i can try it first in ie?
|
1

PrimeNG also provides a component for DatePicker. Live demo;

http://www.primefaces.org/primeng/#/calendar

Comments

1

See this question as a answer of how to use jQuery UI plugins in your app Whats the best way to use jquery widgets inside angular 2?

This example uses ElementRef but you could also use ViewChild

:-)

Comments

0

Here is another one with many configurations, live demo:
https://vlio20.github.io/ng2-date-picker/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.