Mat-tab - Service for each tab

0

I have this code

<mat-card>
  <mat-card-title-group>
    <mat-card-title>Declarações processadas com sucesso</mat-card-title>
  </mat-card-title-group>
</mat-card>
<mat-tab-group (selectedTabChange)="onLinkClick($event)">
  <mat-tab label="Informações comuns">
    <app-informacoes-comum></app-informacoes-comum>
  </mat-tab>
  <mat-tab label="Apuração mensal do ISSQN">
    <app-apuracao-mensal></app-apuracao-mensal>
  </mat-tab>
  <mat-tab label="Demonstrativo contábil">
    <app-demonstrativo-contabil></app-demonstrativo-contabil>
  </mat-tab>
  <mat-tab label="Demonstrativo das partidas dos lançamentos contábeis">
    <app-demonstrativo-partida></app-demonstrativo-partida>
  </mat-tab>
</mat-tab-group>

Each , is a component that has been created, each of which make a query on the server for a specific service.

onLinkClick(event: MatTabChangeEvent) {
    console.log('event => ', event);
    console.log('index => ', event.index);
    console.log('tab => ', event.tab);
    if(event.index == 0){

    } else if(event.index == 1){

    } else if(event.index == 2){

    } else if(event.index == 3){

    } 
  }

I have this event that to validate which tab the user clicked.

I'm trying to make when entering the system only cerrega tab-0 and not loading the others.

The others will only be loaded, if the user clicks the specific tab.

How to do this?

    
asked by anonymous 17.04.2018 / 18:54

0 answers