blaze-tabs icon indicating copy to clipboard operation
blaze-tabs copied to clipboard

Data moved to parent template

Open JobJob opened this issue 9 years ago • 3 comments

This is going to be hastily reported, sorry in advance, let me know if you need more details.

In my routes:

this.render("toptemplate",{data:{info1: "hi", info2: 7}})

Template:

<template name="toptemplate">
  {{#dynamicTabs name="app_sections" tabs=tabs }}
     {{ahelper}}
     {{#tabContent slug="tab1"}}
     tab1 
     {{/tabContent}}
  {{/dynamicTabs}}
</template>

toptemplate.js:

Template.toptemplate.helpers({
  ahelper: function(){
    console.log(Template.currentData().info1) //undefined
    console.log(Template.parentData().info1) //"hi"
  }
})

I guess it should be documented that the template's data is moved to parentData() under those circumstances. It was unexpected for me and took me a bit of time to work out what was wrong. Great lib btw - cheers!

JobJob avatar Apr 21 '15 02:04 JobJob

Thank you for your comment. I just lost a couple of hours wondering where was my data.

jlourenco avatar Apr 24 '15 09:04 jlourenco

:+1:

JobJob avatar Apr 24 '15 15:04 JobJob

Hi there--I've been a little slow with my projects the past week because I'm traveling for work. I'll be sure to update the docs as soon as I have some time to properly go through this.

jonjamz avatar Apr 24 '15 15:04 jonjamz