I'm using Polymer 2.0 and I have a dom-repeat
for different to-do cards. What I want to do is remove the card when I click on it.
So I tried this on-tap=deleteNote([[index]])
which uses the index from the dom-repeat
. However Polymer doesn't execute the function.
What am I doing wrong?
Another solution could be the dataset
object within the event.target
. You can define your properties with the data-
prefix:
<div on-tap="doSomething" data-item$="[[item]]"></div>
And within your doSomething()
listener you can get the dataset
object:
doSomething(event) {
const item = event.target.dataset.item;
...
}
You can access the model via the event argument's model
property.
So you can access the index from event.model.index
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With