WHAT: I am building a website with Angular and I’d like to deploy it on a purely static server (such as Amazon S3). I need to pre-render all HTML pages for the
I've just completed similar task using Angular 4. Site is hosted using Github pages and has no backend. Feel free to use it as example: repo and commit which implements pre-rendering: 0d81d28
I had to implement following changes:
renderModuleFactory
from @angular/platform-server
module and saves generated html in appropriate location./community/overview
then html should be saved into /community/overview/index.html
. Angular matrix params wan't work :( . I had to move matrix params into URL route e.g. instead of /docs;doc=overview.html
use /docs/overview.html
initialNavigation: 'enabled'
into router configuration: RouterModule.forRoot([{ path: '', ...}], { initialNavigation: 'enabled' })
. I still have no idea what initialNavigation is and why it helps.Hope this helps.