I've got this page component template at the url /demo
<mat-form-field>
<input matInput placeholder="Choose a date">
</mat-form-field>
Which renders fine, but as soon as I rewrite this as
<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>
the app redirects to the url /
and does not displays anything but blank space. Nothing is logged in the console.
The code is supposed to work because it's copied from Angular Material basic datepicker example. I've imported MatFormFieldModule
, MatInputModule
and MatDatepickerModule
.
What is happening?