Dynamic Buttons OnClick


#1

Hello,

Still learning the basics and having some issues, below is what I’m trying to do:

<button ion-button (click)="navigate({{post.uid}})">Comments</button>

I’m using ngFor to repeat posts. I have a function called navigate() and need to pass the variable UID. Using the above code im getting Im getting an error:

Unhandled Promise rejection: Template parse errors:
Parser Error: Got interpolation ({{}}) where expression was expected at column 9 in [navigate({{post.uid}})]

How do i go about this?

Thank you,
Harry


#2

Try <button ion-button (click)="navigate(post.uid)">Comments</button>


#3

It worked! Thank you