1
我正在使用下面的代碼,當我點擊時,我沒有得到id。如何在使用角度和離子點擊按鈕時獲取id?
<button ion-item (click)="goToDrivePage()" *ngFor="let eventNames of eventType.events">
{{eventNames.id}}
</button>
任何機構幫助我獲得ID的功能?
我正在使用下面的代碼,當我點擊時,我沒有得到id。如何在使用角度和離子點擊按鈕時獲取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);
}
是它的正常工作 –