Home > Back-end >  Angular material 15 does not have time or datetime picker icon for selection of time or date
Angular material 15 does not have time or datetime picker icon for selection of time or date

Time:01-11

When creating angular 15.0.4 project then added angular material from cli command. Steps to reproduce bug(angular 15.0.4)

  1. ng new sample_project
  2. ng add @angular/material (indigo-pink.css)
  3. added MatFormField and MatInputModule in NgModule enter image description here

    See this updated Stackblitz for a working example.

    CodePudding user response:

    You can use this;

    <mat-datepicker-toggle matIconSuffix>
        <mat-icon matDatepickerToggleIcon>access_time</mat-icon>
    </mat-datepicker-toggle>
    

    but if you want action on click use this;

    <mat-datepicker-toggle matIconSuffix [for]="picker">
       <mat-icon matDatepickerToggleIcon>access_time</mat-icon>
    </mat-datepicker-toggle>
    <mat-datepicker #picker></mat-datepicker>
    
  • Related