0

I am trying to bind date property to mat-datepicker's input when im click on nextDate button. how can I do it? I am using [(ngModel)] but it not working.

my html code

<input   [(ngModel)]="departureDate"  [min]="minDate"
(dateInput)="onDateChange($event)" [matDatepicker]="picker"  placeholder="date"  (click)="_openCalendar(picker)" #elementToFocus>
<button (click)="nextDate()" class="date-btn" type="submit"><mat-icon>keyboard_arrow_right</mat-icon></button>
<button class="date-btn" type="submit"><mat-icon>keyboard_arrow_left</mat-icon></button>
<mat-datepicker #picker="matDatepicker" (closed)="_closeCalendar($event)"></mat-datepicker>

and my method in ts :

 nextDate(){
this.departureDate.setDate(this.departureDate.getDate() + 1) }
Parsia Shiraz
  • 69
  • 2
  • 13

0 Answers0