Passing 'this' to template


I love the way meteor will pass this automatically pass this and the data context to the child template.

But when I add another customize parameter. the data context stop passing

{{> child}} // this will pass the helper and data context
{{> child view=view}} // this will only pass the ‘view’

How do I let this working?


{{> child this=this view=view}}


Thanks that was fast!


That doesn’t work! How to pass it ?


I didn’t try the recently added let keyword, but it should do the trick:

{{#let view=view}}
  {{> child}}


it does work and it is answer to your question.
it defines data context, better said it defines “this” and “view” in data context,
so to access any of these, you need to use that this.something, view.something.
In root of data context would be these 2 objects.


“this” is the parent root data context and view is like this.view.

In {{> child this=this view=view}}
does that mean I have to call this.this to access it instead of just this?
and get this.view to get view?

What if I want to get this and this.view?

My current solution is to use {{> child self}}
var self = this
self.view =view;
return self;
to add view to this and pass this.

let is cool! Is it only in meteor 1.2?
Still doesn’t upgrade to 1.2 since some package have issue with less.



My current solution is simply to install Blaze Components and forget about all the problems with data context. Why worry about unimportant things when Blaze Components takes care of them by default?


How exactly Blaze Components affect problems with data context?
I dont see the connection here.


Thanks for the suggestion. But I think later I’ll try the react approach or wait for Blaze 2