Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data moved to parent template #10

Open
JobJob opened this issue Apr 21, 2015 · 3 comments
Open

Data moved to parent template #10

JobJob opened this issue Apr 21, 2015 · 3 comments

Comments

@JobJob
Copy link

JobJob commented Apr 21, 2015

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!

@jlourenco
Copy link

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

@JobJob
Copy link
Author

JobJob commented Apr 24, 2015

👍

@jonjamz
Copy link
Owner

jonjamz commented Apr 24, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants