I was able to successfully create an Angular 7 SPA rendering on the client side, There's no documentation however for how to render it on the server side.
The only documentation I found is kind of obsolete today because it's for older versions of Angular,
Can we have the above content updated to reflect Angular 7 SSR?
Hello @ahamidou ... This looks to be a duplicate issue, and there might be existing duplicates.
@guardrex I don't 100% agree it's a duplicate, this is about the latest version, Angular 7.
I even tried the above referenced issues, they were no help for me to get SSR to work by any means, so that's why I opened this issue.
On the other hand, let's agree that they're all duplicates... and in which case, why don't we consolidate them and update the documentation once and for all?
Thank you!
One of the issues (#8816) is for 6 (6 was the latest at the time), and it has a post asking to just skip to 7. Others deal with SSR.
I agree that these might be consolidated in some way. @scottaddie will know the best way to handle these issues.
I have been waiting for 3 months to finally see an updated version of the documentation. As of today we still have no clue how to make things work to successfully achieve SSR...
Closing duplicate
I get this is closed, but which one has the solution? I cant get SSR on 2.2 and Ng 7, and the docs are still outdated.
please update the documentation this is is still not solved
I too was struggling to get SSR working with latest template. I ended up starting from scratch with asp.net core 2.2 and angular 7.2. It was surprisingly straightforward and I was even able to get SSR working on the server without the need to deploy node_modules.
You can find the example here if you're interested: https://github.com/joshberry/dotnetcore-angular-ssr.
I'd be interested to know if you see any issues with or shortcomings of the setup.
Thank you for the initiative @joshberry
I took a look at the repository and it sounds good at first glance, I tested it and it worked ust fine including routing and publishing.
Why don't you update the documentation here according to what you've done, it seems very easy, simple, and straight forward!
How did you end up with your working proof of concept, what was your reference to do what you've done?
@ahamidou I could take a look at updating the docs here, but it sounds like MS already has someone working on it. If they don't, I'd be happy to take a stab at it.
The project was basically put together by reading through the Angular Universal and JavaScriptServices docs and browsing through dozens of github issue reports related to angular ssr on dotnet core, gleaning what I could from them. Obviously the current angular template was also a very helpful guide.
Hopefully the official template gets updated to the latest versions soon and they don't drop support for SSR (it appears some don't think it's important but for me it is critical). In the meantime, it's not too difficult to set it up on your own and it really helped me understand the moving parts much better.
I successfully wrote a reproducable article on Medium.
Special thanks goes to Josh Berry. This repository is by far the best ever...
Can you please append this content in the MS docs? It would probably help a lot of people...
Article: https://medium.com/@pieterjandeclippel/server-side-rendering-in-asp-net-core-angular-6df7adacbdaa
Final code with steps: https://github.com/PieterjanDeClippel/AspNetCoreSpaPrerendering
@scottaddie should we check with the PU on getting : https://medium.com/@pieterjandeclippel/server-side-rendering-in-asp-net-core-angular-6df7adacbdaa migrated to the docs?
@PieterjanDeClippel if they approve, we'd need you to make a PR of the content. You could copy/paste the HTML and we could do the MD conversion.
@Rick-Anderson It would be reasonable to link to this, but I'd be cautious about actually copying the content into our docs. The issue is that this is a guide to using multiple third-party libraries together (@nguniversal/express-engine
and Angular itself), which could have breaking changes at any moment. Who's responsible for keeping track of breaking changes and updating the content in the docs each time that happens?
Closing as we're on to 3.0 now
Server-side rendering in ASP.NET Core Angular
is very discoverable
Hi, I guess I'm still clear on the SSR with 3.0. I ran the package.json's "build:ssr": "ng run AspNetCore3:server:dev" to generate main.js the ClientAppdist-server. (I'd like to know what the AspNetCore3:server:dev actually does)
I also set the
What else do I have to do to get it run locally?
Most helpful comment
I too was struggling to get SSR working with latest template. I ended up starting from scratch with asp.net core 2.2 and angular 7.2. It was surprisingly straightforward and I was even able to get SSR working on the server without the need to deploy node_modules.
You can find the example here if you're interested: https://github.com/joshberry/dotnetcore-angular-ssr.
I'd be interested to know if you see any issues with or shortcomings of the setup.