im using the bootstrap datepiker (http://bootstrap-datepicker.readthedocs.io/en/latest/index.html) in my angular 2 application and have some troubles with initializing.
using the following in my component works, but is not pretty
ngAfterViewInit(): void {
setTimeout(function() {
$('.date').each(function() {
console.log($(this));
$(this).datepicker({
format: 'dd.mm.yyyy',
autoclose: true,
calendarWeeks: true,
language: 'de-DE',
todayHighlight: true
});
});
}, 1000)
}
is there a way without the dirty timeout of 1 second to get this working? If i do not have the timeout, the jQuery selector does not return anything and there is no output in the console.