Vishnu .T.D
Vishnu .T.D

Reputation: 93

Is there any method to call a function on clicking a date in mat-datepicker other than dateChange in angular 9?

I need to call a function upon clicking a date in mat-datepicker. dateChange only calls a function if the selected date is changed. I need that function to be called if i click on the same date which is previously set. Is there any method to handle this ?

Upvotes: 0

Views: 1441

Answers (1)

Eliseo
Eliseo

Reputation: 58019

you can always use the "closed" event of the mat-date-picker

  <input #input matInput [matDatepicker]="picker">
  <mat-hint>MM/DD/YYYY</mat-hint>
  <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle> 
  <mat-datepicker #picker (closed)="emit(input)"></mat-datepicker>

Upvotes: 1

Related Questions