For my current project, I am utilizing a date-picker from . How can I implement this date-picker in an Angular 2 component? Do I need to convert the following jQuery code to TypeScript for my component: $('.datepicker').pickadate();
?
my_component.ts
import { Component, OnInit, ElementRef } from '@angular/core';
declare var $: any;
@Component({
// selector: 'clients',
templateUrl: './src/client/app/views/clients.html',
})
export class ClientsModel implements OnInit {
constructor(private _elmRef: ElementRef) {}
/* This code is not functioning as expected */
ngOnInit() {
$(this._elmRef.nativeElement)
.find('#date-picker-example')
.on('click', function(){
$('#date-picker-example').pickadate();
});
}
}
my_component.html
<div class="md-form col-xl-2 col-lg-3 col-md-4 col-sm-6 col-xs-12" style="margin-top: 1%;">
<input type="text" id="date-picker-example" class="form-control datepicker">
<label for="date-picker-example">Date begin</label>
</div>