How do I update my model upon change from Jquery Datepicker? If I manually type into the <input>
the model updates, but the model doesn't update after making a selection from the Jquery Datepicker popup. The <input>
value updates with the selected date, but the model doesn't change.
I've tried wrapping the datepicker() in a timeout, but that doesn't work either. How can I make the model aware of the change in the directive?
Input in Component Template:
<input type="text" class="datepicker" [(ngModel)]="foreigndate" datepicker>
Directive:
@Directive({
selector: '[datepicker]'
})
export class DatePickerDirective {
constructor(el: ElementRef) {
$(el.nativeElement).datepicker();
}
}
Aucun commentaire:
Enregistrer un commentaire