refactor: add loading screen on app initialization
This commit is contained in:
@@ -9,7 +9,7 @@ export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideAppInitializer(() => {
|
||||
const sqlite = inject(Sqlite);
|
||||
return sqlite.initializeDatabase('gptdb');
|
||||
return sqlite.initializeDatabase('gptdb').then( () => document.dispatchEvent(new CustomEvent('ng-boot')))
|
||||
}),
|
||||
{provide: WebSqlite, useClass: WebSqlite},
|
||||
provideBrowserGlobalErrorListeners(),
|
||||
|
||||
@@ -6,8 +6,16 @@
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="preload" href="/scan-loading-screen/scan-loading-screen.css" as="style" />
|
||||
</head>
|
||||
<body>
|
||||
<scan-loading-screen></scan-loading-screen>
|
||||
<app-root></app-root>
|
||||
<script src="/scan-loading-screen/scan-loading-screen.js" fetchpriority="high"></script>
|
||||
<script>
|
||||
document.addEventListener('ng-boot', () => {
|
||||
document.querySelector('scan-loading-screen').remove();
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user