Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
13.x
Description
I use the date picker in calendar mode in the sidebar on the main page. the component is initialized when the application is loaded.
After upgrading from version 13.x to 14.x and after to 15.x I get an error in the console. But the application starts up and the calendar works
<mat-calendar
(selectedChange)="dateChange($event)"
[(selected)]="selectedDate"
[dateClass]="dateStyleFn"
class="app-calendar"></mat-calendar>
Reproduction
Steps to reproduce:
- Angular Universal (SSR) project
- npm run dev:ssr
Expected Behavior
no error
Actual Behavior
ERROR ReferenceError: window is not defined
at apply (./node_modules/@angular/material/fesm2020/datepicker.mjs:289:13)
at invoke (./node_modules/zone.js/dist/zone-node.js:400:30)
at run (./node_modules/zone.js/dist/zone-node.js:160:47)
at runOutsideAngular (./node_modules/@angular/core/fesm2020/core.mjs:24137:28)
at constructor (./node_modules/@angular/material/fesm2020/datepicker.mjs:280:17)
at factory (./node_modules/@angular/material/fesm2020/datepicker.mjs:492:21)
at getNodeInjectable (./node_modules/@angular/core/fesm2020/core.mjs:3484:44)
at instantiateAllDirectives (./node_modules/@angular/core/fesm2020/core.mjs:11038:27)
at createDirectivesInstances (./node_modules/@angular/core/fesm2020/core.mjs:10511:5)
at Module.ɵɵelementStart (./node_modules/@angular/core/fesm2020/core.mjs:13641:9)
Environment
- Angular: ~15.2.1
- CDK/Material: ^15.2.1
- Browser(s): Crome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 64-bit