Wednesday, 15 August 2012

coffeescript - Reuse Meteor template - Isolating events -



coffeescript - Reuse Meteor template - Isolating events -

i tried:

template.skillssearch = $.extend template.skillssearch, rendered: -> session.set('s' + @_id, null) session.set('searchfocused' + @_id, null)

@_id worked before, think because within each statement. not have loop , @ {}(no _id in object).

suppose have this:

body +mytemplate +mytemplate

how unique id per template instance? or, how can create unique session keys when reusing template?

this how solved it:

template(name='father1') 'father1' +reusedtemplate template(name='father2') 'father2' +reusedtemplate template(name='reusedtemplate') h1 #{avariable}

then in coffeescript:

template.reusedtemplate = $.extend template.reusedtemplate, rendered: -> # here @data contains whatever pass in # i.e. 'father1' , 'father2' respectively avariable: -> # here @ contains whatever pass in # i.e. 'father1' , 'father2' respectively

coffeescript meteor jade

No comments:

Post a Comment