Я использую ngx-mydatepicker из https://www.npmjs.com/package/ngx-mydatepicker
Он работает нормально, однако после нажатия на текстовое поле он открывает календарь, который не выровнен по текстовому полю
Код следующий
html:
<form [formGroup]="AddNewFrm" (ngSubmit)="onSubmit(AddNewFrm)">
<div class='row'>
<div class='col-sm-6'>
<div class="form-group form-inline">
<label>Extract Date</label>
<input required class="form-control" placeholder="Select Extract Date" ngx-mydatepicker name="ExtractDate"
[options]="myDateOptions" #dp="ngx-mydatepicker" (click)="dp.openCalendar()" [(ngModel)]="dateModel" (dateChanged)="onDateChanged($event)" />
</div>
</div>
<div class='col-sm-6'>
<a class="btn btn-default"><span class="glyphicon glyphicon-remove"></span>Cancel</a>
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-save"></span>Submit</button>
</div>
</div>
</form
Компонент:
dateModel: any = { date: { year: 2018, month: 10, day: 9 } };
selectedDate: string = '';
myDateOptions: INgxMyDpOptions = {
todayBtnTxt: 'Today',
dateFormat: 'mm/dd/yyyy',
firstDayOfWeek: 'mo',
sunHighlight: true,
disableUntil: { year: 2016, month: 8, day: 10 },
alignSelectorRight: true
};
onDateChanged(event: IMyDateModel): void {
this.selectedDate = event.formatted;
}