【发布时间】:2016-08-17 06:45:34
【问题描述】:
我有以下 HTML 代码:
<table>
<tr *ngFor='let product of products'>
<td>
<button [hidden]="hidebutton" (click)="Follow(product.Id)">Follow</button>
</td>
</tr>
</table>
以及我的 Typescript followproduct.component.ts 中对应的点击事件:
@Component({
---
---
})
export class followproduct implements onInit{
hidebutton: boolean = false;
Follow(productId: number) {
---
this.hidebutton = true;
}
}
点击一个产品的关注按钮后,迭代中其他产品的所有按钮都会被隐藏——这也很明显,因为我将隐藏选项分配给迭代按钮标签。
有什么方法可以隐藏、更新或更改*ngFor的仅选择性迭代的按钮?
【问题讨论】:
标签: javascript angular typescript