question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular Universal error

See original GitHub issue

Describe the bug I am seeing an issue with running angular-calendar using Universal/SSR. The specific issue is one step lower with the angular-draggable-droppable package where it is failing to find a definition for window, which is to be expected on Universal.

Minimal reproduction of the problem with instructions N/A Applies to Universal only, not sure that I can do a Stackblitz with universal.

Screenshots `/Users/User/Projects/project/website/node_modules/angular-draggable-droppable/bundles/angular-draggable-droppable.umd.js:118 for (var i = 0, limit = prefix.length; i < limit && !window.requestAnimationFrame; ++i) { ^

ReferenceError: window is not defined at /Users/User/Projects/project/website/node_modules/angular-draggable-droppable/bundles/angular-draggable-droppable.umd.js:118:57 at /Users/User/Projects/project/website/node_modules/angular-draggable-droppable/bundles/angular-draggable-droppable.umd.js:141:3 at createCommonjsModule (/Users/User/Projects/project/website/node_modules/angular-draggable-droppable/bundles/angular-draggable-droppable.umd.js:19:36) at /Users/User/Projects/project/website/node_modules/angular-draggable-droppable/bundles/angular-draggable-droppable.umd.js:109:35 at /Users/User/Projects/project/website/node_modules/angular-draggable-droppable/bundles/angular-draggable-droppable.umd.js:2:82 at Object.<anonymous> (/Users/User/Projects/project/website/node_modules/angular-draggable-droppable/bundles/angular-draggable-droppable.umd.js:5:2) at Module._compile (module.js:652:30) at Object.Module._extensions…js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12)`

Versions

  • @angular/core: 6.1.7
  • angular-calendar: 0.27.8
  • Browser name and version: macOS / Chrome 74.0.3729.169

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:25 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
piotrbrzuskacommented, Apr 2, 2020

@anishchcenko you need to add these 2 lines to the top of the server.ts file for it to work: https://github.com/mattlewis92/angular-calendar#is-this-library-aot-and-universal-compatible

It works!

1reaction
jovicazariccommented, Jun 17, 2019

Hi @mattlewis92, thank you a lot. The fix works. I am able to render calendar with SSR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle Server and Client errors in Angular Universal ...
The problem​​ One of the main issues that arose when trying Angular Universal for one of my personal projects, was the inability to...
Read more >
Angular Universal: real app problems - InDepth.Dev
SSR issues in Angular · 1. Infinite page loading · 2. Lack of cache out of the box · 3. Server errors of...
Read more >
Getting error while executing angular universal app
I am working angular 13 application and trying to ...
Read more >
NetworkError With Angular Universal · Issue #1207 - GitHub
I used Webpack TranslateLoader and it solved the error. It was because the Angular SSR is trying to get the translation file using...
Read more >
Server-side rendering (SSR) with Angular Universal
Because a Universal application doesn't execute in the browser, some of the browser APIs and capabilities might be missing on the server. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found