1 year ago

#248900

test-img

Tim Hardy

Can Angular Universal dynamically prerender static HTML?

Everything I'm reading about Angular Universal is about one of two distinct paths...

  1. Server Side Rending - hit a url and it will dynamically serve up a full Angular application
  2. Prerending - manually run a build step, and it will generate very lean static HTML files (no Angular js files) that can be served however you like

I need the lean static HTML of the Prerendering functionality with the dynamic functionality of the SSR. I need the Prerendering functionality to be dynamically triggered. Ideally, I want to hit an api endpoint or route (including an id) that will, at that moment, generate a very lean static html file (no Angular js files included). It can either be output as a file to the filesystem or just serve it up as HTML - either way works for me.

I'm considering using this for a JAMstack project, and what I've seen of the Prerending functionality isn't nearly nimble enough. Having to manually run a build to Prerender the entire site misses most of the best functionality of JAMstack. When a particular datapoint changes, you have to be able to generate just the pages that are affected, and you need to do it dynamically, not with a manual build step.

Anyone try the above and have any ideas? My searches always land firmly in one of the camps listed at the top there.

angular

server-side-rendering

angular-universal

jamstack

pre-rendering

0 Answers

Your Answer

Accepted video resources