DNRN DNRN - 2 months ago 26
jQuery Question

How to use bootstrap/jquery in Angular2

How is the best way to use a bootstrap plugin like Eonasdan/bootstrap-datetimepicker in Angular2?

I use jspm in my setup and have installed Eonasdan/bootstrap-datetimepicker. The I include the javascript in my Component:

import { datepicker } from 'Eonasdan/bootstrap-datetimepicker';

In AfterViewInit I have tried to add the .datetimepicker() to the html element like this:

ngAfterViewInit() {
var elm = <HTMLDivElement>document.getElementById('datetimepicker1');

But this is not working. How can I solve this issue?


Instead of leaving a comment I prefer to post this as answer (as demanded by @DNRN) because it may helpful to someone else in the future.

You test the solution without having to import any extra files, I have posted a solution online using the datepicker component and bootflat as a styling framework as well as a date picker library or for more info you can refer to this link...

enter image description here enter image description here

Here are few More best articles/libraries for datepicker