1

I am using the below code and i am not getting id when i am clicking.

<button ion-item  (click)="goToDrivePage()" *ngFor="let eventNames of eventType.events">
          {{eventNames.id}}
       </button>

any body help me to get id in the function?

1 Answer 1

9

Pass the id value to the function

<div *ngFor="let eventNames of eventType.events">
  <button ion-item  (click)="goToDrivePage(eventNames.id)">
      {{eventNames.id}}
  </button>
</div>

In ts file get the value

goToDrivePage(id : any){
     console.log(id);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.