-1

How to get the value from selected cell of a mat table. I attached a sample code in which, the row and index can be fetched. But i want the value from the selected cell.

I attached a sample code at stackblitz and required format in image below,

required format

1 Answers1

1

If you only want to get the value of the selected column you can make the cell as HTMLElement and get the text from it. You can add this in the code:

select(event: MouseEvent, cell: HTMLElement) {
    
     const value = cell.textContent;
     console.log(cell.textContent);
     
     .....
     .....
Apoorva Chikara
  • 8,277
  • 3
  • 20
  • 35