javascript - Rivets.js: When button is clicked, call a function with an argument from a data binding -
this infuriating. seems should simple, can't find magic incantation.
here's gist of need do:
<div rv-each-thing="data.things"> <input type=button value="click" onclick="abc( {thing} )"> </div>
that should illustrate need do. i've tried many different things, nothing seems work.
below default configuration of event handler rivets website:
// augment event handler of on-* binder handler: function(target, event, binding) { this.call(target, event, binding.view.models) }
so apart event object, can reference models related particular binding second argument.
using can access particular object
for example
<div rv-each-thing="data.things"> <input type=button value="click" onclick="abc"> </div> function abc(event,rivetsbinding){ rivetsbinding.thing //heres thing :) }
Comments
Post a Comment