0

I am using MatDatePicker from Angular Material.

Preferably I want to only use the date picking view from the datepicker, without having an input field from which it opens.

I also want to keep the datepicker open, so it is statically a part of the view.

Currently the datepicker is set up like this:

<input type="text" matInput [matDatepicker]="datePickerFrom" readonly name="fromDate" [(ngModel)]="lookup.FromDate" #fromDate="ngModel">
<mat-datepicker #datePickerFrom [opened]="true" [startView]="'month'">
</mat-datepicker>

The datepicker initiates opened as intended, but since it is in the foreground, it will close when the user clicks anywhere else but the date picker itself.

Futhermore, the datepicker requires a input field - intended use is to open the datepicker from an input field, and select a date using the datepicker view. Is it possible to only use the datepicker view to select a dat, without the input field ?

Maybe the Angular Material Date Picker isn't the way to go for this purpose, so any alternatives might be the real answer to this question.

Jonas Praem
  • 2,296
  • 5
  • 32
  • 53

1 Answers1

6

Import the MatDatePickerModule but use the <mat-calendar></mat-calendar> component

Mauro Doza
  • 331
  • 2
  • 14