I have imported MatDatepickerModule and getting mat-datepicker-actions are not known. I guess there is some other module that needs to import. Here is code snippet:
<mat-form-field appearance="fill" class="example-form-field">
<mat-label>Choose a date</mat-label>
<input matInput [matDatepicker]="datepicker">
<mat-datepicker-toggle matSuffix [for]="datepicker"></mat-datepicker-toggle>
<mat-datepicker #datepicker>
<mat-datepicker-actions>
<button mat-button matDatepickerCancel>Cancel</button>
<button mat-raised-button color="primary" matDatepickerApply>Apply</button>
</mat-datepicker-actions>
</mat-datepicker>
</mat-form-field>
Note: anyone provides solution within the
angular-materiallibrary, not third party (normally has too much size). I'll be thankful.
You need to import MatDatepickerModule and MatNativeDateModule into your module for which your component is a part of. I use below for Angular 11
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
@NgModule({
declarations: [
...
],
imports: [
...
MatNativeDateModule,
MatDatepickerModule
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With