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

153
Visualizações
Cannot pass information from DataSource to TypeScript?

I am using mat-table to generate a table with two columns, one with an ID and another that is a checkbox with a button at the top. There are 15 rows of data.

<mat-table [dataSource]="dataSource$">
     <ng-container matColumnDef="process">
        <mat-header-cell #checkBox *matHeaderCellDef> Process </mat-header-cell>
        <mat-cell *matCellDef="let execution"> {{execution.process}} </mat-cell>
     </ng-container>
     <ng-container matColumnDef="reprocess">
      <mat-header-cell *matHeaderCellDef>  
         <button tslbutton class="tslbutton" (click)="reprocessHomeProcesses(execution)" id="reprocessButton">
            Reprocess
         </button> 
      </mat-header-cell>
      <mat-cell id="reprocessCell" *matCellDef="let execution">
         <mat-checkbox class="checker"></mat-checkbox>
      </mat-cell>
   </ng-container>
</mat-table>

In my typescript function I'm literally just trying to print it before anything else. This won't work.

reprocessHomeProcesses(exe) {
    console.log(exe)
  }

However, it does display on the screen with {{execution.process}}

Basically, when an item is checked, I want its corresponding process information to be passed back to TS to make an API call. However, I cannot pass execution from HTML no matter what I try.

Above you can see I'm trying to pass execution directly, however this returns undefined. To start I would just like to be able to pass the execution information back to TS. After that I'd like to be able to select as many processes as needed using the checkboxes and then pass them to TS to be called with an API.

Is there a reason I cannot print execution? Why am I able to view it perfectly in the HTML but I cannot print it to console via TS? What can I do?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

matHeaderCell does not have any data.

matCell has the data. Notice the let execution.

You can do the same click function inside matCell.

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