私の仕事でhttp://mdbootstrap.com/javascript/date-picker どのように角度2のコンポーネントで日付ピッカーを使用することができますか?私のコンポーネントのtypescriptコンポーネント$('.datepicker').pickadate();
にjqueryでこのコードを追加する必要があります。どのように角度2でmdbootstrapを使用できますか?
my_component.tsのjQueryを使用して
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 not work*/
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>
あなたは 'ControlValueAccessor'を使用しています。この例を見てみることができます' http://stackoverflow.com/questions/40973990/jquery-datepicker-in-angular2-application-input- format-should-different-from-displ – yurzui