Angular: ReferenceError: document is not defined
I want to use Angular Universal for server side rendering for abp's angular project, I set it up according to the official angular documentation and then I solved the localstorage problem according to an answer on StackOverflow.
Running yarn dev:ssr and opening the page, I get the error message(some paths are replaced with ***):
ReferenceError: document is not defined
at Object.AppendToHead (***\dist\***\server\main.js:101810:28)
at Object.AppendStyleToHead (***\dist\***\server\main.js:102399:59)
at Object.factory (***\dist\***\server\main.js:109658:91)
at R3Injector.hydrate (***\dist\***\server\main.js:161018:35)
at R3Injector.get (***\dist\***\server\main.js:160834:33)
at injectInjectorOnly (***\dist\***\server\main.js:154324:33)
at ɵɵinject (***\dist\***\server\main.js:154328:61)
at injectArgs (***\dist\***\server\main.js:154408:23)
at Object.factory (***\dist\***\server\main.js:161109:52)
at R3Injector.hydrate (***\***\server\main.js:161018:35)
...
After checking the dist***\server\main.js file, I guessed that this problem might be caused by using the document element in DOM_STRATEGY.
Any help is appreciated. Thanks.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
ping?
A slight bump, this made angular universal unusable.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, @muhammedaltug @EngincanV Any suggestions for using Angular Universal?