简体   繁体   English

(TS)属性行在类型HTMLInputElemet上不存在

[英](TS)Property Rows does not exist on type HTMLInputElemet

Hi I am new to angular and type script..I need to check whether table is empty or not and depending upon that I need to hide or display a div. 嗨,我是角度和类型脚本的新手。我需要检查表是否为空,并根据需要隐藏或显示div。 I tried, 我试过了,

var rows = document.getElementById('associatedEmailsTable'))rows; and
var rows =(<HTMLInputElement>document.getElementById('associatedEmailsTable')).rows;

but both are giving same result, Please help me in this. 但两者都给出了相同的结果,请对此提供帮助。

Please suggest me how can I find whether table tr has any value inside it or not using javascript. 请建议我如何使用JavaScript查找表tr是否具有任何值。

and My HTML code is 我的HTML代码是

   <table class="table table-sm table-hover" id="associatedEmailsTable" style="display:none">
       <tr>
            <th>
              Email
            </th>
            <th>
              Action
            </th>
          </tr>
          <tr *ngFor="let oEmailAddress of this.associatedEmailAddresses">
            <td>{{oEmailAddress.email}}</td>

          </tr>
        </table>

The issue is exactly what the error says, "Property Rows does not exist on type HTMLInputElemet". 问题恰恰是错误所说的,“ HTMLInputElemet类型不存在属性行”。

Assuming that you have <table id="associatedEmailsTable">... then what you have is a HTMLTableElement . 假设您具有<table id="associatedEmailsTable">...那么您拥有的就是HTMLTableElement So: 所以:

var rows = (document.getElementById('associatedEmailsTable') as HTMLTableElement).rows;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Typescript:类型“{}”.ts 上不存在属性“set” - Typescript: Property 'set' does not exist on type '{}'.ts TS2339:类型“ {}”上不存在属性“ props” - TS2339: Property 'props' does not exist on type '{}' 错误TS2339:类型“字符串”上不存在属性“默认”。** - Error TS2339: Property 'Default' does not exist on type 'string'.** 属性“模块”在类型“ typeof MyEditor”上不存在。ts(2339) - Property 'modules' does not exist on type 'typeof MyEditor'.ts(2339) Typescript 通用:“T”类型上不存在属性“pass”.ts(2339) - Typescript generic : Property 'pass' does not exist on type 'T'.ts(2339) 类型 'void | 上不存在属性 'subscribe' 可观察的<user> '。 ts(2339)</user> - Property 'subscribe' does not exist on type 'void | Observable<User>'. ts(2339) TS2339:“元素”类型上不存在属性“样式” - TS2339: Property 'style' does not exist on type 'Element' “TypedResponse”类型上不存在属性<never> '.ts(2339)</never> - Property does not exist on type 'TypedResponse<never>'.ts(2339) 错误 TS2339:类型“CustomerTransfert[]”上不存在属性“num” - error TS2339: Property 'num' does not exist on type 'CustomerTransfert[]' 输入字段上的“TS2339:属性...在类型...上不存在” - “TS2339: Property … does not exist on type …”, on input field
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM