[英]How to get id and name value of button on click event in ionic 2 angular 2
[英]how to get id when we are click the button using angular and ionic?
我正在使用下面的代碼,並且單擊時沒有獲得ID。
<button ion-item (click)="goToDrivePage()" *ngFor="let eventNames of eventType.events">
{{eventNames.id}}
</button>
任何機構都可以幫助我獲取功能中的ID?
將id值傳遞給函數
<div *ngFor="let eventNames of eventType.events">
<button ion-item (click)="goToDrivePage(eventNames.id)">
{{eventNames.id}}
</button>
</div>
在ts文件中獲取值
goToDrivePage(id : any){
console.log(id);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.