Today marks the launch of my latest Angular project built with Angular 11.0.0. I decided to incorporate the
@angular-material-components/datetime-picker
package, which is now reflected in my package.json file:
...
"@angular/core": "~11.0.0",
"@angular/material": "^11.0.0",
"@angular/animations": "~11.0.0",
...
"@angular-material-components/datetime-picker": "^4.0.5",
...
Everything within my codebase runs smoothly except for a snag in my HTML involving the mat-datepicker-toggle
linked to ngx-mat-datetime-picker
. This error message pops up:
error TS2322: Type 'NgxMatDatetimePicker<any>' is not assignable to type 'MatDatepickerBase<MatDatepickerControl<any>, any, any>'.
Here's a snippet of my HTML code showcasing the issue:
<input matInput [ngxMatDatetimePicker]="picker" placeholder="Choose a date"
formControlName="scheduledStartDateTime"
[min]="minDate"
(dateChange)="dateUpdated()" >
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker [showSpinners]="true" [showSeconds]="false"
[stepHour]="1" [stepMinute]="1" [stepSecond]="1"
[touchUi]="false" [enableMeridian]="false"
[disableMinute]="false" [hideTime]="false">
</ngx-mat-datetime-picker>
To bypass this validation error and maintain a functional project, altering the tsconfig.json file like so can be done:
"angularCompilerOptions": {
...
"strictTemplates": false
}
However, my preference leans towards enforcing strict template rules with
"strictTemplates": true
.
If there's something I'm overlooking or if you folks could provide feedback on when this bug will be rectified, it would be greatly appreciated.