How to pre-render Angular pages

Pre-rendering generates static HTML for your Angular pages at build time, providing instant page loads and perfect SEO without requiring a Node.js server. As the creator of CoreUI, a widely used open-source UI library, I’ve implemented prerendering for Angular applications throughout my 11 years of framework development. The most efficient approach is using Angular Universal’s built-in prerender builder to generate static pages during the build process. This method combines the benefits of SSR with the simplicity of static hosting.

Configure Angular Universal and use the prerender builder to generate static HTML pages.

ng add @nguniversal/express-engine
ng run your-app:prerender

Here the first command adds Angular Universal with prerendering support to your project. The second command builds your application and pre-renders all configured routes into static HTML files. Configure routes to prerender in angular.json under the prerender options. The generated files can be deployed to any static hosting service while maintaining full Angular functionality after hydration.

Best Practice Note:

This is the approach we recommend for CoreUI Angular applications with mostly static content and predictable routes. List all routes in the prerender configuration, use route guards carefully as they execute during prerender, and consider combining prerendering for public pages with SSR for authenticated areas.


Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.

Answers by CoreUI Core Team