ZouYouShun / ngx-hm-carousel

a light carousel for Angular18+, support mobile touch by hammerJs
https://stackblitz.com/edit/stackblitz-starters-nkd5pk?file=src%2Fmain.ts
MIT License
60 stars 10 forks source link

Support for Angular 9 SSR. #27

Closed kamilogerto2 closed 4 years ago

kamilogerto2 commented 4 years ago

Hey. Pure hammer js is causing the problems with window reference in the Angular SSR project. To solve that - it's needed to add https://www.npmjs.com/package/@egjs/hammerjs . But since we added that - ngx-hm-carousel is not working.

It's possible to switch from the hammer js library to egjs/hammerjs in hm-carousel?

Cheers!

ZouYouShun commented 4 years ago

Hi @kamilogerto2, not import hammerjs in your SSR environment, you can separate main.ts and main.server.ts to use that.

kamilogerto2 commented 4 years ago

Sure. It's an option and I will do that probably. But it would by nice to support that out of the box with egjs ;) There is some reason why you don't want to switch?

ZouYouShun commented 4 years ago

thinks we don't have a strong motivation to switch into egjs, I using hammerjs because @angular/material, but that seems can be removed in angular v9.

Maybe I will remove hammerjs in the feature.

thanks for your suggestion.