Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I work on angular 7
when loop to table html and compile i get error
95% emitting CopyPlugin
ERROR in src/app/Pages/part-compare/part-compare.component.ts(25,38): error TS2339: Property 'rows' does not exist on type 'HTMLElement'.
src/app/Pages/part-compare/part-compare.component.ts(27,26): error TS2339:
Property 'rows' does not exist on type 'HTMLElement'.


How to solve this error please ?

What I have tried:

var table = document.getElementById("CompareParts");
    for (var i = 1, row; row = table.rows[i]; i++) {
      for (var j = 0, col; col = row.cells[j]; j++) {
        var Cell = table.rows[i].cells
        this.ACells.push(Cell);
      }
    }
    this.length=this.ACells.length
    for (var x = 0; x < this.ACells.length; x++) {
      this.ARows.push(this.ACells[x]);
Posted
Updated 11-Feb-20 5:22am

1 solution

You need to cast the element returned from getElementById to an HTMLTableElement.

Try:
JavaScript
var table = <HTMLTableElement>document.getElementById("CompareParts");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900