We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41f1f6f commit cd18489Copy full SHA for cd18489
templates/Angular2Spa/ClientApp/boot-client.ts
@@ -16,8 +16,11 @@ if (hotModuleReplacement) {
16
enableProdMode();
17
}
18
19
-// Boot the application
+// Boot the application, either now or when the DOM content is loaded
20
const platform = platformUniversalDynamic();
21
-document.addEventListener('DOMContentLoaded', () => {
22
- platform.bootstrapModule(AppModule);
23
-});
+const bootApplication = () => { platform.bootstrapModule(AppModule); };
+if (document.readyState === 'complete') {
+ bootApplication();
24
+} else {
25
+ document.addEventListener('DOMContentLoaded', bootApplication);
26
+}
0 commit comments