Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!