I do not know if I understand the question correctly, but:
Can you pass the actual model to a mustache? for example when rendering
render: -> rendered_content = @template({model: @model}) $(@.el).html rendered_content @
You pass the actual model to the template. Then you have a template
<td class="quantity"> <input type="text" value="<%= model.get('quantity') %>" name="quantity" /> </td> <td> <%= model.getTotalPrice() %> </td>
And in the model you declare getTotalPrice ()
getTotalPrice: -> total_price = @get('price') * @get('quantity') total_price + total_price * @get('tax_rate')
In fact, I never miss @ model.toJSON in my templates, alawys is the actual model.
source share