Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Angular can render a route in the browser, generate its HTML at build time, or render it on the server for each request. Its hybrid-rendering model lets you choose per route: use prerendering for public pages with build-time data, server-side rendering (SSR) for request-specific content, and client-side rendering (CSR) where browser execution is the right fit. SSR does not automatically make an app faster or improve its search rankings; the result depends on the route, implementation, and deployment.

What Angular server-side rendering does

With SSR, Angular renders the requested route into HTML on the server. The first document sent to the browser can therefore include application content before the browser downloads and runs the full client application. Angular then initializes in the browser and takes over the rendered page.

This differs from a CSR-first route, where the browser runs the application code to produce the page. It also differs from prerendering, where HTML is generated once during a build rather than for each request. Angular describes these options as hybrid rendering because an application can use different modes on different routes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How hydration hands the page to the browser

Hydration is the client-side handoff after SSR. Angular restores the server-rendered application and reuses its DOM where possible. As Angular’s hydration guide puts it, “Hydration is the process that restores the server-side rendered application on the client.”

Without hydration, Angular destroys the server-rendered content and renders the application again in the browser. That replacement can cause visible flicker or layout shifts. Angular CLI-created SSR applications include hydration, but verify the setup and behavior in the project’s actual Angular version.

Choose a rendering mode by route

Angular’s route configuration uses three modes: RenderMode.Client, RenderMode.Prerender, and RenderMode.Server. The right choice depends on when a route’s data is available, whether it varies by visitor, and what runtime your deployment can support.

Mode When HTML is rendered Visitor-specific data Rendering infrastructure Key trade-off
CSR (RenderMode.Client) In the browser Can be loaded after client logic runs No rendering server is needed beyond serving application assets Content may wait for JavaScript and data requests; browser-oriented features can fit naturally
Prerendering / SSG (RenderMode.Prerender) At build time Not in the generated HTML when it varies by visitor Static hosting or a CDN can serve generated files without rendering each request Build-time data must be sufficient; many generated routes can increase build time, output size, or deployment time
SSR (RenderMode.Server) On each request Can be rendered for a request, with secure, correctly scoped server logic A server runtime must perform rendering Requires server work and code that is compatible with server execution

For example, a public About page whose content is known during the build could be prerendered; a profile page containing request-specific information could use SSR; and a route built around browser-only interaction could remain CSR. These are examples, not fixed rules. Review Angular’s hybrid-rendering guide and RenderMode API reference when mapping the modes to your routes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use CSR when the browser is the natural runtime

CSR can suit routes whose features depend on browser APIs or whose content is loaded by client logic. Its trade-off is that meaningful content may not appear until JavaScript runs and any required data requests complete. Search crawlers also have limits on JavaScript execution, so do not assume every crawler will process a client-rendered page the same way a browser does.

Use prerendering when route content is known at build time

Prerendering generates HTML as part of the build, making it useful for public pages with data that does not need to vary by visitor. Because the host serves completed files rather than rendering each request, it can avoid per-request rendering work. The cost can move to build and deployment time, particularly if many parameterized routes must be generated.

Angular’s current guide also documents outputMode: 'static', which produces prerendered HTML without generating a server file. This output is appropriate only when the required pages can be produced at build time. A page requiring user-specific information cannot be represented by one shared static document without a later client-side data step.

Use SSR when the response needs request-time rendering

SSR can place rendered application content in the initial response while allowing the server to use request-time data. That makes it a candidate for routes whose output differs by request, provided the server implementation handles that data securely and scopes it to the right visitor. Rendering on the server adds runtime work and means the code executed there must not assume a browser environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add SSR or hybrid rendering to an Angular project

Angular’s current guide documents these CLI entry points:

  • For a new project, use ng new --ssr.
  • For an existing project, use ng add @angular/ssr.

Commands, generated files, and defaults can vary by Angular version. Check the output and instructions for the version used by your application before adapting examples.

In the server route configuration, assign a rendering mode to each path. Angular’s documented example uses CSR for /, prerendering for /about, and SSR for a personalized /profile route, with a server-rendered catch-all. Adapt those paths to your app’s data model. For prerendered routes with parameters, ensure the build can enumerate the required route values.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check server compatibility and correctness

Browser globals are not guaranteed to exist during server rendering. Angular’s v20 SSR guide specifically warns about browser-specific globals such as window, document, navigator, and location. Keep browser-dependent operations in browser-only code paths. The v20 guidance identifies afterRender and afterNextRender for work that should run only in the browser; confirm the current API behavior for the version your app targets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use these checks when reviewing an implementation:

  • Inspect the initial HTTP response and confirm it contains the expected content for the requested route.
  • Confirm hydration reuses the server DOM without a visible replacement or rendering mismatch.
  • Check that data included in server-rendered HTML is safe to expose and scoped to the correct request.
  • Ensure personalized responses are not placed in an inappropriate shared cache.
  • Estimate whether generating all parameterized pages at build time is practical.
  • Match deployment to output: request-time SSR requires a server runtime, while static output can be served by static hosting or a CDN.

These checks establish whether the chosen mode works correctly for your application; they are not a substitute for measuring its actual user experience.

What SSR does—and does not—promise for SEO and speed

Server-rendered or prerendered HTML can make route content available in the initial document, rather than requiring a crawler to execute the client application first. Angular’s v20 guide says prerendered pages generally have excellent SEO because crawlers receive rendered HTML. That is not a guarantee of rankings: search performance depends on the site and its implementation, and the documentation does not establish a ranking lift from choosing a rendering mode.

Likewise, receiving HTML sooner does not prove that a page is faster overall. SSR shifts rendering work to the server, CSR can defer content until browser JavaScript and data requests finish, and prerendering trades request-time rendering for build-time work. Evaluate the routes and deployment you actually operate rather than treating any one mode as an automatic performance win.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.