I'm using ngx-sortablejs in my application, and works as expected, the only problem is that this same application uses Angular Universal to server side rendering, and the following error is returned from the server:
ReferenceError: window is not defined
at new Sortable (/var/www/app/dist/server/main.js:121650:73)
at Function.Sortable.create (/var/www/app/dist/server/main.js:123098:12)
at Timeout.<anonymous> (/var/www/app/dist/server/main.js:135544:87)
at ZoneDelegate.invokeTask (/var/www/app/dist/server.js:578:31)
at Zone.runTask (/var/www/app/dist/server.js:350:47)
at ZoneTask.invokeTask (/var/www/app/dist/server.js:653:34)
at Timeout.ZoneTask.invoke (/var/www/app/dist/server.js:642:48)
at Timeout.timer [as _onTimeout] (/var/www/app/dist/server.js:2387:29)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
Is there anything to do in order to avoid its load on the server side? Or is it something that the original library should - maybe - do?
By now I'm handling this problem with isPlatformBrowser and not rendering it through *ngIf, but it doesn't look nice.
Hello,
I'm using ngx-sortablejs in my application, and works as expected, the only problem is that this same application uses Angular Universal to server side rendering, and the following error is returned from the server:
Is there anything to do in order to avoid its load on the server side? Or is it something that the original library should - maybe - do?
By now I'm handling this problem with
isPlatformBrowser
and not rendering it through*ngIf
, but it doesn't look nice.Thanks for your great work.