1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to have loading screen before data is loaded

Discussão em 'Angular' iniciado por anscom ooi, Maio 25, 2025.

  1. anscom ooi

    anscom ooi Guest

    I want to have a loading screen before data is loaded. My data is collected from ngOnInIt and I want to make sure that the page will only show after data is loaded.

    @if (!(dataReady$ | async)) {
    <div class="spinner-overlay">
    <app-loader/>
    </div>
    }
    <hr>
    <div>
    <h1>something</h1>
    <p>secondthing</p>
    </div>


    protected dataReady$ = new BehaviorSubject(false);
    protected amountChange = signal(DetailsService.name);


    I tried setting a boolean inside ngOnInit, but it did not help as the HTML loads first.

    Continue reading...

Compartilhe esta Página