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

For a whole Angular route, use Angular prerendering (static site generation, or SSG): Angular generates the route’s HTML during the build. For an HTML string in code, Angular’s renderModule API renders an NgModule application to a serialized string. Neither method is a universal export button for an arbitrary live component instance. Choose based on whether you need a deployable page or a string, and whether the page’s data is available at build time.

First decide what “an Angular view” means

A route such as /about or /products/123 is usually best converted with prerendering. This creates HTML documents as part of the application build, ready to deploy as files. It is a good fit when the content can be determined in advance and does not have to change for each visitor.

If code needs a rendered HTML string, Angular documents renderModule, which bootstraps an NgModule application and serializes its page content. Its scope is an application render—not a general-purpose method for exporting any standalone component or already-running view. Check compatibility with the Angular version and architecture in your project.

These approaches differ from taking a screenshot of a page in a browser. Prerendering produces HTML for your Angular routes; a screenshot captures the visual output of a URL.

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

Choose prerendering, server rendering, or client rendering

Mode When rendering happens Request-specific output Runtime and deployment Good fit Trade-offs
Prerender (SSG) At build time Not for each visitor; the generated document is shared Static files can be served by static hosting or a CDN; with static output, no Node.js server file is required Routes whose content is available at build time and is not user-specific Builds and generated-file counts can grow with the number of routes. Rebuild and redeploy when build-time content changes.
Server-side rendering (SSR) For each request Yes, when the application is designed to use request-specific information Requires a server runtime Pages that need request-time or user-specific rendering Request-time work can raise hosting costs. Code must avoid assumptions about browser-only APIs.
Client-side rendering (CSR) In the visitor’s browser Can vary in the browser as application data changes Angular’s default behavior; the browser downloads and runs JavaScript Browser-dependent interactive applications The browser must execute JavaScript before Angular-rendered content appears.

Prerendering produces initial HTML, but it does not make Angular event handlers work in a browser with JavaScript disabled. Hydration can reuse server-rendered markup and restore interactivity when the application loads. For output that must vary by request, use SSR rather than trying to make one shared prerendered file serve personalized content. See Angular’s SSR guide and rendering strategies.

Prerender Angular routes to static HTML files

  1. Add Angular SSR support. In an existing application, run ng add @angular/ssr. When creating a project, Angular also documents ng new --ssr. Confirm the command against the documentation for your installed Angular major version.
  2. Assign a rendering mode to each route. In the server route configuration, use RenderMode.Prerender for pages that can be generated at build time. Choose RenderMode.Server for pages that need request-time rendering, or RenderMode.Client for client-only pages. The route’s data requirements—not just its URL—should determine the mode.
  3. Supply concrete values for parameterized routes. For a route such as /products/:id, define getPrerenderParams so Angular knows which IDs to generate. The data needed to build each page must be available during the build. If the set of possible values is large or changes frequently, consider whether generating all those files remains practical.
  4. Request static output. Set outputMode to static in the Angular build configuration. Angular documents this mode as generating prerendered HTML without a server file, so deployment does not require a Node.js server.
  5. Build, inspect, and deploy the generated files. Run your project’s build command, verify the output includes the expected route documents, then deploy those files to static hosting. Static files can be cached by browsers and CDNs. Rebuild and redeploy when content embedded at build time changes.
  6. Check the page in a browser. Confirm the HTML contains the expected content, then test links, forms, and other interactive behavior with the application’s client-side code loaded. Prerendered markup alone does not run Angular event handlers.

Exact project file names and configuration layout can vary with Angular version and application setup. Use Angular’s SSR documentation for the current route configuration and build options.

Use renderModule when you need an HTML string

Angular’s renderModule API bootstraps an NgModule app and returns a promise for serialized page content. It is useful when an application-level server render is the intended output, but it is not a shortcut for rendering an isolated component without the surrounding app setup.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

The API accepts a document template and a URL along with the module and its bootstrap options. The following illustrates the shape of an application-level call; provide your own NgModule, template, and URL as appropriate for your app:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { renderModule } from '@angular/platform-server';
import { AppServerModule } from './src/main.server';
import { readFile } from 'node:fs/promises';

const document = await readFile('./dist/browser/index.html', 'utf8');
const html = await renderModule(AppServerModule, {
  document,
  url: '/about',
});

console.log(html);

The imports and template path must match your project; this snippet is not a universal drop-in build script. Ensure the server module and its dependencies are configured for server rendering. Consult the Angular renderModule API reference and test against your installed version. Angular describes the API as one that “Bootstraps an application using provided NgModule and serializes the page content to string.”

Keep rendering safe and compatible with the server

Keep page structure in Angular templates and use Angular’s supported rendering flows. Angular advises against directly inserting, removing, or modifying DOM elements as a general practice. Assigning untrusted content to innerHTML can expose an application to cross-site scripting (XSS); template bindings include safeguards that direct assignment does not provide.

Do not rely on Renderer2 DOM manipulation as a way around server-rendering constraints: Angular documents that these APIs do not support DOM manipulation in SSR or build-time prerendering contexts. Also check third-party packages and application code for browser-only assumptions, such as access to browser APIs during server execution. See Angular’s DOM APIs guidance.

Or skip the browser setup

If your goal is a visual capture of a deployed Angular route—not HTML generated from Angular source—ScreenshotNeo takes a screenshot from one GET request. It is a screenshot API, not an Angular prerenderer. For example, save a WebP capture of a public route:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://example.com/about 
  -o shot.webp

See the ScreenshotNeo API documentation for setup and options. Before capture, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to try the API.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Troubleshoot common conversion problems

  • A parameterized page is missing from the output: Check that the route is configured for prerendering and that getPrerenderParams returns the concrete parameter values to generate. Confirm that build-time data loading succeeds for those values.
  • The page is blank or incomplete after prerendering: Inspect the generated HTML and build output. Check for failed data requests and code or dependencies that assume browser APIs are available during rendering.
  • Generated HTML appears, but controls do nothing: Static markup is not the same as a fully interactive Angular application. Confirm client-side JavaScript loads and hydration or application bootstrap is configured as intended.
  • The page shows stale data: A prerendered document reflects build-time content. Rebuild and redeploy after that content changes, or choose SSR if the response must reflect request-time information.
  • renderModule does not fit a standalone component: Its documented scope is bootstrapping an NgModule application. It is not a universal arbitrary-component export API; verify the appropriate render flow for your Angular architecture and version.
  • Server rendering fails after adding a library: Check whether the library touches browser-only APIs during server execution. Replace or isolate incompatible code using an approach supported by your rendering setup rather than directly mutating the DOM.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and deployment trade-offs

Prerendering moves route rendering work to the build. Once generated, static files can be served and cached without running Angular on a server for each request. The trade-off is that build work and output volume grow with the routes you generate, and the files need rebuilding to reflect changed build-time data.

SSR moves rendering to request time, which supports request-specific output but requires a server runtime and adds request-time work. CSR avoids build-time route generation and server rendering, but visitors depend on JavaScript execution before Angular-rendered content appears. There is no universal performance percentage: the outcome depends on the application, its routes, data, runtime, and deployment.

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

For a mostly public site with stable content, prerender the routes whose data is available at build time and deploy the files to static hosting or a CDN. Keep request-specific routes on SSR where necessary. This mixed approach avoids forcing every page into a single rendering mode.

Frequently Asked Questions

Does static Angular HTML work without JavaScript?

The generated markup can be served as HTML, but Angular event handlers and other client-side behavior require the application’s JavaScript to load.

Can I prerender every possible route parameter?

Only if you can supply the concrete parameter values and their data at build time; the generated route set is determined by those values.

Is ScreenshotNeo a way to export Angular source as HTML?

No. It captures the visual output of a URL as an image or PDF; use Angular prerendering for route HTML files.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

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.