如何使用插值将值作为参数传递给函数

时间:2019-04-09 09:40:32

标签: angular typescript

如何将{{c.id}}参数插入函数(而不是在32处列出的位置)?

library(purrr)
mylist <- list( a = tibble(n = numeric()),
      b = tibble(n = 1:4))
discard(mylist, function(z) nrow(z) == 0)
$b
# A tibble: 4 x 1
      n
  <int>
1     1
2     2
3     3
4     4

2 个答案:

答案 0 :(得分:2)

只是:

(click)="removeCompany(c.id)"

答案 1 :(得分:1)

在* ngFor内部传递带有对象值的局部变量,在您的情况下,它将是c.id,其中包含ID

<tr *ngFor="let c of myService.companyList">
    <td>{{c.name}}</td>
    <td>{{c.email}}</td>
    <td>{{c.password}}</td>
    <td> <input type="submit" value="click to remove" (click)="removeCompany(c.id)" (click)=/> </td>
    <td> <a href="">Click here to remove this company {{c.id}}</a></td>
</tr>