ngxDaterangepickerMd Open datepicker from outside in angular

1.2k views Asked by At

I struggle to open ngxDaterangepickerMd from outside. I need two single-datepickers, one for the "from date" and one for the "to date". When I click on the from-button the from-datepicker should open and when I click on the to-button the to-datepicker should show up. Yet in my case when I click on the to-datepicker, the from-datepicker opens instead.

This is the code for my from-button:

 <input type="text" class="datepicker-calendar-icon"  ngxDaterangepickerMd  [locale]="{ format: 'DD/MM/YYYY' }" [(ngModel)]="startDate" [singleDatePicker]="true"
                        [autoApply]="true" [minDate]="minDate" (change)="setStartDate()" />
<button>from</button>

This is the code for my to-button:

 <input type="text" class="datepicker-calendar-icon"  ngxDaterangepickerMd  [locale]="{ format: 'DD/MM/YYYY' }" [(ngModel)]="endDate" [singleDatePicker]="true"
                        [autoApply]="true" [minDate]="minDate" (change)="setStartDate()" />
<button>to</button>

I followed this as reference https://github.com/fetrarij/ngx-daterangepicker-material#open-datepicker-from-outside

Do you have any idea how I can solve this problem?

0

There are 0 answers