A demo of server to browser state transfer (hydration), using Angular 8.
$ yarn install
$ yarn build:ssr
$ yarn serve:ssr
Navigate to http://localhost:4000
.
A mock API is implemented for the display of users' details.
State Transfer is implemented for the following:
- API loaded data, users list/detail views (
src/app/module/users/services/user-repository.service.ts
) - Configuration
- Browser (
src/app/module/core/service/browser-config.service.ts
) - Server (
src/app/module/core/service/server-config.service.ts
)
- Browser (
This repository also contains some concepts outside of state transfer I required for a personal proof of concept, including:
- Lazy-loaded modules
- Dynamic content resolution
Reference: https://blog.angularindepth.com/using-transferstate-api-in-an-angular-5-universal-app-130f3ada9e5b