Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

118
Visualizações
angular check column in matCellDef loop

How do we check a column in an ng for loop in angular ? for example I dont wanna apply the logic below which is {{element[p.key] != null ? '$' : ''}} to column 1 or execept column 1

enter image description here

#html code

<table mat-table [dataSource]="bovDemos" class="mat-elevation-z0">
                    <ng-container  *ngFor="let p of marketDemographicsTableLabel; last as l" matColumnDef="{{p.key}}">
                      <th mat-header-cell *matHeaderCellDef class="fs-12px">{{p.label}}</th>
                      <ng-container >
                        <td  mat-cell *matCellDef="let element; index as i"
                        [ngClass]="{'border-none': i === bovDemos.length - 1}" class="fs-12px">
                        {{element[p.key] != null ? '$' : ''}}{{(element[p.key]) ? (element[p.key] | number): '-'}}</td>
                      </ng-container>
                    </ng-container>
                    <tr mat-header-row *matHeaderRowDef="tableMarketDemographicsHeaders"></tr>
                    <tr mat-row *matRowDef="let row; columns: tableMarketDemographicsHeaders;" class="cursor-default">
                    </tr>
                  </table>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You have set "index as i", so you can use "i" to detect first td.

<span *ngIf="i===0">
   ..this is first column
 </span>
<span *ngIf="i!==0">
{{element[p.key] != null ? '$' : ''}}{{(element[p.key]) ? (element[p.key] | number): '-'}}
</span>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda