dhutaryan / ngx-mat-timepicker

Material timepicker based on material design
https://dhutaryan.github.io/ngx-mat-timepicker/
MIT License
75 stars 8 forks source link

fix: for ssr compliance, don't use window directly #133

Closed Sefy closed 8 months ago

Sefy commented 8 months ago

Hello,

In order to be SSR (server prerendering) compliant, could you make the "Window" usage optional ? With the new Angular 17 "standalone" (no module) architecture, I couldn't find a way to override the problematic components only in server mode, because of the "direct reference" to "window" object in your main module, as soon as I import it, the compiler just won't take it ...

image

So I finally thought I'd try editing your cool lib :) My solution is not the best or really efficient (and I don't want to make your code look less clean), so I thought I'd just post this PR to suggest the change, but let you do the real job, if you find some time, and if you don't mind .. :D

Thanks in advance.

dhutaryan commented 8 months ago

Nice catch! I forgot about it, thank you.

dhutaryan commented 8 months ago

Fixed in 17.3.0. I've made components standalone. If you find that something doesn't work, please create an issue. Thank you.