I have a date-picker from angular material. On click of some event, I'm getting the new date from api service. How do I change the date on some click event?
By Default, I have some date. After click the submit button, there is some api handled(assume), on subscribing the response values there is a variable with date format.
How do I change the date on some click event?
<mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> <br/>
<button (click)="dosomeaction()">Submit</button>
export class DatepickerOverviewExample {
dosomeaction = function(){
let date = "2018/09/04";
//assign the above date to the input field
}
}