front-end – How to show “loading” screen


Good afternoon, I'm a beginner in angular and I have the following doubt:

Is it possible for me to have a selector accessible on all my components?

I bring my component as follows:

import { CarregandoComponent } from '../carregando/carregando.component';
selector: 'app-questions',
templateUrl: './questions.component.html',
styleUrls: ['./questions.component.css'],
entryComponents: [CarregandoComponent]

The problem is that in every html that I want to load I must put the selector


I would just put it in one place, I tried it on index.html but it had no effect.

Can anyone help me? Thanks


You must create a service eg CarregandoComponentService and upload it to your app.module . So it will become a singleton in your application and any subcomponent will have access to the same instance of this service.

Then press the component CarregandoComponent the html of your app.component.html and use CarregandoComponentService to control this through the other components.

Load the service into the component you want to use it and you have control of the CarregandoComponent .

Scroll to Top