L
L
Leopandro2019-10-21 21:27:55
Angular
Leopandro, 2019-10-21 21:27:55

Mat-darepicker not taking date from ngModel?

<mat-form-field class="full-width-field">
  <input matInput [(ngModel)]="form.date_to" [matDatepicker]="picker" placeholder="Дата задачи">
  <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
  <mat-datepicker #picker></mat-datepicker>
</mat-form-field>

form = {
    id: null,
    user_id: null,
    comment: null,
    type: null,
    date_to: null,
    task_object: null,
  };
initFormValues() {
    Object.assign(this.form, this.data['model']);
    this.form.date_to = moment(this.data['model']['date_to']); //делал и так
  }

The date is not displayed and that's it, I tried even through jquery still nothing.
There is one caveat - the component is displayed in this way:
let dialogRef = this.dialog.open(TasksEditModalComponent, {
        width: '650px',
        minHeight: '250px',
        data:
          {
            model: task,
            users: users,
          }
      });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question