How to make splash screen with progress tracking in Angular?

●1 ●2 ●9
calendar_today • schedule2 min read
— Originally published at dev.to

Preface

Loading all initialization data in an Angular application can sometimes take a while—especially over slow internet connections. Displaying a blank screen during this time can lead to a poor user experience.

To mitigate this, we can introduce a splash (or loading) screen to provide users with immediate visual feedback, making the app feel more responsive and polished.

Demo Project

Splash Screen Demo

The demo below showcases a working implementation of a splash screen:

⚡ Try this code on StackBlitz or GitHub

Should the Splash Screen Be a Component?

Short answer: ❌ no.

Here's why:

  • Angular components aren’t rendered until after the framework bootstraps. This means any splash screen defined as a component would appear too late to be useful.

  • Initialization tasks like HTTP requests should be handled in provideAppInitializer, before Angular even begins rendering the UI.

File: app/app.config.ts

⚡ View on StackBlitz

    provideAppInitializer(async () => {
      const initializers: AsyncInitializer[] = [
        inject(ConfigLoaderService),
        inject(ConnectionCheckerService),
        inject(StorageInitializerService),
        inject(TranslationLoaderService),
      ];
  for (const initializer of initializers) {
    await performAsyncInitialization(initializer);
  }

  await splashFadeOut();
}),

> For demonstration purposes, `performAsyncInitialization()` simulates a delay by waiting one second.

> The `splashFadeOut()` function starts the fade-out animation and waits for it to complete.

##  Where Should Splash Screen Styles and Scripts Go?

You can embed splash screen styles and scripts directly inside the `<app-root>` tag in index.html. This ensures they appear instantly and can be easily removed once the app is initialized, leaving no residue behind.

**File**: `index.html`

> ⚡ [View on StackBlitz](https://stackblitz.com/~/github.com/ArkadiuszPabian/NgSplashScreen?file=src/index.html)
```html
<app-root>
  <!-- START Splash screen -->

  <!-- Styles -->
  <style>
    [...]
  </style>

  <!-- Content -->
  <div class="splash-container" id="splash">
    <div class="circle-outline"></div>
    <svg>
      [...]
    </svg>
    <div class="loading-text">
      <span id="updater">Loading Angular app</span>
      <span class="jumping-dots">
        <span class="dot"></span>
        <span class="dot"></span>
        <span class="dot"></span>
      </span>
    </div>
  </div>

  <!-- Place for scripts -->

  <!-- END Splash screen -->
</app-root>

If the splash screen code is large, consider moving styles and scripts into external files for better maintainability. However, this introduces a trade-off: additional HTTP requests will slightly delay the splash screen's appearance. Also, these files must reside in the public folder, increasing the final build size.

Can I Update the Splash Screen Dynamically?

Yes, you can dynamically modify the splash screen—for example, to show real-time progress updates.

To do this, reference a DOM element by its id and update its content during app initialization. Be mindful: both the HTML and Angular logic must reference the same id, so consistency is key.

File: index.html

⚡ View on StackBlitz

<span id="updater">Loading Angular app</span>

File: app/core/utils/splash-screen.utils.ts

⚡ View on StackBlitz

export function updateTitle(text: string): void {
  const elem = document.getElementById('updater');
  if (elem) {
    elem.textContent = text;
  }
}

Bottom line

  • Splash screens in Angular are not only possible—they're practical.
  • Since Angular lacks a built-in solution, a custom inline approach is the most efficient and reliable.
  • Keep splash logic minimal and inline, and ensure it is removed cleanly once the app is initialized.

What's Next (Advanced Topics)

To elevate this implementation and make it suitable for production-grade apps, here are some advanced areas worth exploring:

  • ⚡ Optimize Splash Screen Load Time After First Load
    Cache initialization data (e.g. app config, feature flags) using LocalStorage or IndexedDB, so it can be reused without delay.

  • ️ Integrate with Service Worker for Offline & Fast Loads
    Ensure splash screen assets (HTML, images, inline styles) are cached by your Angular Service Worker.

Want more #webdev & #frontend deep dives?

Join 6,159+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

5 Comments

2 votes
1
1
1
0

More Posts

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

The Senior Angular Take‑Home That Made Me Rethink Tech Interviews

Karol Modelski - Apr 2

Stop Treating Angular as a Second-Class Framework for UI Components

Karol Modelski - Apr 16

Three Design-to-Code Rules Most Developers Ignore (That Will Make You a Better Engineer)

Joemetry - Sep 26
chevron_left
159 Points • 12 Badges
2Posts
2Comments
4Connections
Senior Full Stack Dev (7+ years) juggling Angular, Node.js & .NET. CKAD certified cloud fan into CI/... Show more

Related Jobs

View all jobs →

Commenters (This Week)

5 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!