mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Previously, the state `script` was always appended as the last item in the `body` tag. This can result in the state not being available when the Angular application is bootstrap.
A workaround for this was to delay the bootstrapping of the application until by using the `DOMContentLoaded` event listener.
```ts
const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);
document.addEventListener('DOMContentLoaded', bootstrap);
```
With this change the above workaround is no longer necessary as the state `script` tag is now added prior of any other `script` which guarantees that the state is present prior of the Angular application is bootstrapped.
PR Close #48868
|
||
|---|---|---|
| .. | ||
| BUILD.bazel | ||
| integration_spec.ts | ||
| server_styles_host_spec.ts | ||
| transfer_state_spec.ts | ||