Closed wvanooijen92 closed 8 years ago
Thanks.
The second parameter in your method will be an array of the string arguments appended in the binding expression – and the third parameter will be an object with the keyword arguments passed to the {{bind}}
helper.
You can write it like this:
Template.a.viewmodel({
add(e, args) {
let quantity = args[0];
console.log(quantity, parseFloat(quantity));
}
}
But better yet, pass the number using a keyword argument (either hardcoded or dynamically through a variable):
<div class="col s2 center" {{bind "click: add" quantity=-1}}><i class="material-icons">remove</i></div>
add(e, a, kwargs) {
console.log(kwargs.quantity);
}
Please close the issue if your problem has been solved.
Yes, ofc. Thanks for answering so quickly!
Hi,
First of all, great project!
I have a template named a with the following html:
In my JS i have:
Why is quantity an array? I expected it to be -1
Thank you!