How to show "loading" screen

1

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

Can I have a handy selector on all my components?

I bring my component as follows:

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

The problem is that in every html I want loading I should put the selector

<carregando[isRunning]="isRequesting"></carregando>

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

Does anyone know how to help me? Thanks

    
asked by anonymous 08.01.2017 / 17:15

1 answer

0

You should create a service such as CarregandoComponentService and load it into 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.

Next, just load the CarregandoComponent component in the html of your app.component.html and use CarregandoComponentService to control it through the other components.

Load the service on the component that wants to use it and you will have control of CarregandoComponent .

    
12.01.2017 / 18:29