我正在研究angular 4,并试图通过单击十字按钮来移除标记的功能。所以下面是我的代码:如何在onclick事件中获得角度4中的跨度值?
Component.hmtl
<ul id="ul_top_hypers">
<li *ngFor="let hero of technologies">
<span class="badge badge-pill badge-primary" >{{ hero }}<i class="fa fa-cross-circle-right fa-lg" (click)="removeTag1($event)"></i></span>
</li>
</ul>
Component.ts
removeTag(event: any) {
console.log(event.target.parentNode.value);
console.log(event.target.value);
}
我想通过点击十字按钮,这样我可以删除让每一个li
元素的跨度值那个微小的标签。但我在控制台中创建了undefind
。
任何帮助太明显。
什么是“跨度值”? –
选中此 https://stackoverflow.com/questions/45757633/how-to-delete-a-particular-row-from-table-in-angular-2-by-clicking-delete-button/45757794#45757794 – SergioEscudero