Accessing globals from pre-rendering #1443

Closed
opened 2025-08-09 17:20:09 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @danjford on 8/10/2016

Hi,

I've followed the steps in the documentation to put server prerendered data into an Angular 2 application.

However, even though I can see that the data is available in the window (through the console), components can't seem to access the window like in the example i.e. window.userData. When this is attempted the application complains saying that the window is not defined.

Are we meant to access the pre-rendered data in another way?

*Originally created by @danjford on 8/10/2016* Hi, I've followed the steps in the [documentation](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#user-content-3-supplying-javascript-code-to-perform-prerendering) to put server prerendered data into an Angular 2 application. However, even though I can see that the data is available in the window _(through the console)_, components can't seem to access the window like in the example i.e. `window.userData`. When this is attempted the application complains saying that the `window is not defined`. Are we meant to access the pre-rendered data in another way?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1443
No description provided.