meteor - Spacebars - insert params in pure javascript without handlebars style braces -
i have spacebars template creating button invokes modal:
{{#bootstrapmodal triggerlabel="delete" triggericon="fa-trash-o" triggerclass="btn-danger" id="deletemodal" title="delete item" closelabel="no" primarylabel="delete it!" infoid="item123" infoname="document 123" }} sure want delete? {{/bootstrapmodal}}
the bootstrapmodal template:
<template name="bootstrapmodal"> <button class="btn {{triggerclass}}" data-toggle="modal" data-target="#{{id}}"> {{#if triggericon}} <i class="fa {{triggericon}}"> {{triggerlabel}}</i> {{/if}} </button> <div class="modal fade" id="{{id}}"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">{{title}} {{infoname}}</h4> </div> <div class="modal-body"> {{> ui.contentblock}} <b>{{infoname}}</b> </div> <div class="modal-footer"> {{#if closelabel}} <button type="button" class="btn btn-default" data-dismiss="modal">{{closelabel}}</button> {{/if}} <button type="button" class="btn btn-primary">{{primarylabel}}</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
which creates button, assigns modal , use helper assign functionality modal.
i using excellent reactive tables package , fn capability https://github.com/ecohealthalliance/reactive-table#virtual-columns. use object params insert table cell gather can't use handlebars / spacebars {{ }} syntax within function. can point me in right direction? have code below...
{ key: 'hello', label: "tools", fn: function(value, object) { var context = { triggerlabel: "delete", triggericon: "fa-trash-o", triggerclass: "btn-danger", id: "deletemodal", title: "delete item", closelabel: "no", primarylabel: "delete it!", infoid: object._id, infoname: object.name } // how insert context object bootstrapmodal spacebars template in raw js?
}
am relatively new meteor, clues?
you can use #with
helper change current context in handlebars:
{{#with context}} {{#bootstrapmodal}} ... {{/bootstrapmodal}} {{/with}}
Comments
Post a Comment