wKoza / ngx-upload

Ngx-upload is an upload module for Angular Ivy ready
30 stars 15 forks source link

Angular Universal (SSR) compatibility #71

Closed ilueckel closed 4 years ago

ilueckel commented 4 years ago

Fixed NgxDragAndDropDirective breaking SingleSiteRendering (SSR) in Angular universal. Using @HostListener breaks Angular universal

        Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Event]),
                                                                                       ^

ReferenceError: Event is not defined

So I removed all Event-Types and @HostListeners, injected the platform ID and added event listening via Renderer2 when the platform is a browser.