There might be many different things that cause that problem.
First make sure to not touch the Window object when you’re on server-side. You can check if
window exists and then run your code. Angular also gives you the ability to check if the platform is server, or browser.
Take Google Analytics as an example and imagine there is no type definition for it. What should we do?
Just make a link to the Google Analytics script in your HTML page, then in your Angular TypeScript file, then you can say
You should link your script (library) in your HTML, and declare it in your TypeScript. Take a look at this answer on StackOverflow:
My first suggestion is to create a new project and follow the toutorial steps to make sure if everything works fine or there is still a problem. Or try to clone the GitHub repository and run the Universal there!
Usually the problems are from the external modules you’re using in your project.
I used transfer state using an special module, I think three checks are necessary before using
observable.of, because it can cause problems:
1- If it’s the first route (no route changing)
2- If it’s the browser
3- If there is a value in the transfer state variables.
Thanks for the article
You mean your styles just work on the browser side and after transition!
Can you please fill and issue on the GitHub repository and also provide some codes (.angular.cli.json, package.json)?