I'm using the new version of angular and angular material. I need to get the value of the datepicker
at the moment the user change the date to then pass that value to a function and do something.
datepicker
<mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Choose a date" [(ngModel)]="roomsFilter.date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker [(ngModel)]="roomsFilter.date" ngDefaultControl (selectedChanged)="onChange($event)"></mat-datepicker>
</mat-form-field>
and this the function.
public onChange(event: any, newDate: any): void {
console.log(event.target.value);
// this.getData(newDate);
}
console.log(event)
? plnkr.co/edit/8c21pXDrx7OCq93Gppa0?p=preview – AJT82