For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /api/angular-lynx/host/splash-screen.md.

LynxSplashScreen

Keeps the app's splash screen up until the app's first screen is ready, then fades it out. import { LynxSplashScreen, provideSplashScreen, type SplashScreenOptions, type SplashScreenHide } from '@blotch/angular-lynx';

Set it up in angular.json

The splash screen's image and color come from the build target's splash option:

angular.json
"options": {
  "splash": {
    "image": "src/assets/splash.png",
    "imageWidth": 180,
    "backgroundColor": "#F4EFE6"
  }
}

Without an image, iOS shows the color alone, and Android the app's icon. The splash screen covers every field, and dark mode.

Usage

app.config.ts
export const appConfig: ApplicationConfig = {
  providers: [
    provideRouter(routes),
    // Keeps the splash screen up until the first navigation ends (its
    // guards and lazy routes resolved, its screen drawn), then fades it out.
    provideSplashScreen({ hide: 'afterFirstNavigation' }),
  ],
};

An app whose first screen waits on something other than the router hides it itself:

provideSplashScreen({ hide: 'manual' });

// Once the app's first screen is ready:
inject(LynxSplashScreen).hide();

The phone takes a splash screen down as soon as the app draws its first frame. In an AngularLynx app that frame would be empty:

  • The app hasn't run yet.
  • Its first screen may have work to do before it can draw, such as restoring a signed-in session from LynxSecureStorage, or running a lazy route's guard.

So the apps ng build --platform makes keep it up until the app hides it here.

HostWhat hide() does
iOS and Android (ng build --platform, ng serve --platform)Fades the splash screen out once what the app has drawn is on screen
Web preview, Lynx ExplorerSets visible() to false: there's no splash screen of the app's own
Unit tests (testing library)Sets visible() to false, which a spec can check

API

provideSplashScreen()

function provideSplashScreen(
  options?: SplashScreenOptions,
): EnvironmentProviders;

type SplashScreenOptions = {
  readonly hide?: SplashScreenHide;
};

type SplashScreenHide = 'afterFirstNavigation' | 'manual';

Says when the splash screen goes. Without it, it goes at the first frame Angular draws.

hideThe splash screen goes
'afterFirstNavigation' (default)Once the router's first navigation has ended, and its screen is drawn
'manual'When the app calls LynxSplashScreen.hide()

With 'afterFirstNavigation':

  • The navigation ends once its guards and resolvers have run, and its lazy routes have loaded.
  • A guard's redirect is followed to the screen it leads to.
  • A navigation that fails ends it too.
  • It needs the router: it throws without provideRouter().

LynxSplashScreen

@Injectable({ providedIn: 'root' })
class LynxSplashScreen {
  readonly visible: Signal<boolean>;
  hide(): void;
}
MemberDescription
visibleWhether the splash screen is still up: true until hide() is called, by the app or the runtime
hide()Fades the splash screen out, once the changes the app has made so far are drawn. Calling it again does nothing

After five seconds, the apps take the splash screen down anyway, whether or not the app has hidden it. So a first screen that never settles can't leave the app behind its logo.