We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I was trying to implement a simple list, based on the samples provided.
The following JS:
listTemplate = "<div class=\"ItemsList\">\n <ul each=\"{{items}}\">\n <li>\n {{name}} <button on-click=\"{{ this.removeItem.bind(this, $index) }}\">Remove</button>\n </li>\n </ul>\n</div>"; List = ripple(listTemplate).use(each); List.prototype.removeItem = function(index) { return this.data.items.splice(index, 1); }; list = new List({ data: { items: [ { name: "Name1" }, { name: "Name2" } ] } }); list.appendTo('.Page');
Renders to this:
<div class="ItemsList"> <ul each="{{items}}"><li> Name1 <button on-click="function () { [native code] }">Remove</button> </li><li> Name2 <button on-click="function () { [native code] }">Remove</button> </li></ul> </div>
And the button doesn't trigger the removeItem function which is part of the List prototype.
removeItem
Any idea what I may be doing wrong?
The text was updated successfully, but these errors were encountered:
Hi @lmartins, The missing plugin you're looking for is events. 👍
var List = ripple(listTemplate) .use(each) .use(events);
Sorry, something went wrong.
oohh, such a silly mistake. Thanks @chrisbuttery
No branches or pull requests
I was trying to implement a simple list, based on the samples provided.
The following JS:
Renders to this:
And the button doesn't trigger the
removeItem
function which is part of the List prototype.Any idea what I may be doing wrong?
The text was updated successfully, but these errors were encountered: