adev/src/content/guide/routing/rendering-strategies.md
This guide helps you choose the right rendering strategy for different parts of your Angular application.
Rendering strategies determine when and where your Angular application's HTML content is generated. Each strategy offers different trade-offs between initial page load performance, interactivity, SEO capabilities, and server resource usage.
Angular supports three primary rendering strategies:
CSR is Angular's default. Content renders entirely in the browser after JavaScript loads.
✅ It can be a good fit for:
❌ When possible, consider avoiding it for:
| Aspect | Impact |
|---|---|
| SEO | Poor - content not visible to crawlers until JS executes |
| Initial load | Slower - must download and execute JavaScript first |
| Interactivity | Immediate once loaded |
| Server needs | Minimal outside of some configuration |
| Complexity | Simplest because it works with minimum configuration |
SSG pre-renders pages at build time into static HTML files. The server sends pre-built HTML for the initial page load. After hydration, your app runs entirely in the browser like a traditional SPA - subsequent navigation, route changes, and API calls all happen client-side without server rendering.
✅ It can be a good fit for:
❌ When possible, consider avoiding it for:
| Aspect | Impact |
|---|---|
| SEO | Excellent - full HTML available immediately |
| Initial load | Fastest - pre-generated HTML |
| Interactivity | After hydration completes |
| Server needs | None for serving (CDN-friendly) |
| Build time | Longer - generates all pages upfront |
| Content updates | Requires rebuild and redeploy |
📖 Implementation: See Customizing build-time prerendering in the SSR guide.
SSR generates HTML on the server for the initial request for a route, providing dynamic content with good SEO. The server renders HTML and sends it to the client.
Once the client renders the page, Angular hydrates the app and it then runs entirely in the browser like a traditional SPA - subsequent navigation, route changes, and API calls all happen client-side without additional server rendering.
✅ It can be a good fit for:
❌ When possible, consider avoiding it for:
| Aspect | Impact |
|---|---|
| SEO | Excellent - full HTML for crawlers |
| Initial load | Fast - immediate content visibility |
| Interactivity | Delayed until hydration |
| Server needs | Requires server |
| Personalization | Full access to user context |
| Server costs | Higher - renders on the initial request for a route |
📖 Implementation: See Server routing and Authoring server-compatible components in the SSR guide.
| If you need... | Use this strategy | Why |
|---|---|---|
| SEO + Static content | SSG | Pre-rendered HTML, fastest load |
| SEO + Dynamic content | SSR | Fresh content on the initial request for a route |
| No SEO + Interactivity | CSR | Simplest, no server needed |
| Mixed requirements | Hybrid | Different strategies per route |
When using SSR or SSG, Angular "hydrates" the server-rendered HTML to make it interactive.
Available strategies:
📖 Learn more:
@defer blocks