BeastCode/VSCode-Angular-TypeScript-Snippets

matDatePicker not working

Bobrovskih opened this issue · 1 comments

Hello,
I use Angular 6 Snippets v6.0.12

and mat-datepicker not working
extension output this template:

<mat-form-field>
    <input matInput [matDatepicker]="picker" placeholder="title">
        <button matSuffix [matDatepickerToggle]="picker"></button>
    </mat-form-field>
<mat-datepicker #picker></mat-datepicker>

then compile, and chrome console output error
Can't bind to 'matDatepickerToggle' since it isn't a known property of 'button' ...

From https://material.angular.io/components/datepicker/examples
date picker template should be like this:

<mat-form-field>
  <input matInput [matDatepicker]="picker" placeholder="Choose a date">
  <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
  <mat-datepicker #picker startView="year" [startAt]="startDate"></mat-datepicker>
</mat-form-field>

Looks like the datepicker been updated. Nice catch. Try it now.