Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使角度表单元格可单击以触发事件_Javascript_Html_Angular - Fatal编程技术网

Javascript 使角度表单元格可单击以触发事件

Javascript 使角度表单元格可单击以触发事件,javascript,html,angular,Javascript,Html,Angular,我想让下面HTML表中的“name”列元素在单击时触发一个事件 我添加了角点击表达式活页夹,如下所示。下面我遗漏了什么 <table class="table table-hover"> <thead class="thead-dark"> <tr> <th>Name</th> <th>Address</th> <th>Description</t

我想让下面HTML表中的“name”列元素在单击时触发一个事件

我添加了角点击表达式活页夹,如下所示。下面我遗漏了什么

<table class="table table-hover">
  <thead class="thead-dark">
    <tr>
      <th>Name</th>
      <th>Address</th>
      <th>Description</th>
      <th>Is active?</th>
      <th>Owned User Id</th>
      <th>Display Id</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let venue of venues[0]">
      <td (click)="onVenueNameClick()">{{venue.name}}</td>
      <td>{{ven.addr}}</td>
      <td>{{ven.desc}}</td>
      <td>{{ven.isact}}</td>
      <td>{{ven.userid}}</td>
      <td>{{ven.displayid}}</td>
    </tr>
  </tbody>
</table>

名称
地址
描述
是活动的吗?
拥有的用户Id
显示Id
{{地点.名称}
{{ven.addr}}
{{ven.desc}}
{{ven.isact}}
{{ven.userid}
{{ven.displayid}

html看起来不错,你能不能也显示打字脚本?您能否将console.log添加到onVenueNameClick()中,以查看它是否进入函数?@Jelle是的,它正在工作。我在onVenuNameClick()中添加了console.log,可以看到日志记录。非常感谢。如何在单击时突出显示此表格单元格?@Rohit如果您希望我们帮助您在单击时突出显示表格单元格。请编辑您的帖子,并添加相关注释,以便我们进一步帮助您。