Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Nothing works inside each if no content provided after #179

Open
Dartv opened this issue Oct 14, 2015 · 2 comments
Open

Nothing works inside each if no content provided after #179

Dartv opened this issue Oct 14, 2015 · 2 comments
Labels

Comments

@Dartv
Copy link

Dartv commented Oct 14, 2015

Dunno if it's bug or not.
Consider this code:

each items
  +Template.dynamic(template=../template data=this)

It just doesn't work, but if I add some content after all works fine.

each items
  +Template.dynamic(template=../template data=this)
// now it works
@mquandalle mquandalle added the bug label Oct 15, 2015
@AlbinoGeek
Copy link
Contributor

---Confirmed this bug as happening also when using UI.ContentBlock to define your own components (that thing that's supposed to make #1 missing not hurt so much...)

I'll note that this happens with things that extend spacebars too, such as {{#sortable}}---

@AlbinoGeek
Copy link
Contributor

Ignore my above comment.

This isn't really a bug per se, @RevelsGit explained an intentional situation. "this" is always the current data context, as {{this}} will literally output the value stored in "this.data (from the Template point of view.)" I would imagine this is because variables are compiled by Spacebars/Handlebars at the end of the day. Your point data=this would require a data context on the template being used in. The point of ../template means that the parent data context must also be set (as with ..)

If any of this is incorrect please feel free to correct, it's speculation as to how I see it working.

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

No branches or pull requests

3 participants