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/splash-screen.md.

LynxSplashScreen

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

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, and 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, its guards and resolvers run and its lazy routes loaded, and its screen is drawn. A guard's redirect is followed to the screen it leads to. A navigation that fails ends it too
'manual'When the app calls LynxSplashScreen.hide()

'afterFirstNavigation' 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

The apps also take the splash screen down five seconds after they start, whether or not the app has hidden it, so a first screen that never settles can't leave the app behind its logo.