https://github.com/kamilkisiela/angular-async-ssr
How to make an async operation to be SSR friendly (angular universal)
https://github.com/kamilkisiela/angular-async-ssr
angular angular-ssr angular-universal ssr
Last synced: 6 months ago
JSON representation
How to make an async operation to be SSR friendly (angular universal)
- Host: GitHub
- URL: https://github.com/kamilkisiela/angular-async-ssr
- Owner: kamilkisiela
- Created: 2017-04-18T13:09:57.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-19T09:04:13.000Z (about 9 years ago)
- Last Synced: 2024-12-27T03:12:32.628Z (over 1 year ago)
- Topics: angular, angular-ssr, angular-universal, ssr
- Language: TypeScript
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# angular-async-ssr
How to make an async operation to be SSR friendly (angular universal)
## Background
An Application bootstraps when it turns to be stable (`ApplicationRef.isStable`).
It happens on few cases. One of them is when there's no pending MacroTasks (`NgZone.hasPendingMacrotasks`).
Let's say you do a basic async request, for example using **Fetch API**.
It's being scheduled as a MicroTask which means Angular treats it as something not important to wait for.
## Schedule MacroTask
A solution could be to schedule a MacroTask. Take a look at [an example implementation](./src/app/api.service.ts).