Meta-parameters for template invocation


I think in Meteor should be some way to pass an additional info along template invocation without affecting it’s data context passing rules.


{{> myTemplate [name]="first" [role]="notify" name="someName" a=1 b=2 }}

In this example the actual data context should be {a:1, b:2, name:"someName"} and the meta-context shoul be {name: 'first', role: 'notify'}. Like the former is available in Template.instance().data, the later should be available in Template.instance().meta.

In current implementation we can routhly emulate this by aggregating both data context and meta-context into data and meta object and pass them like:

{{> myTemplate meta=meta data=data }}

where myTemplate starts with:

<template name="myTemplate">
   {{#with data}}

This solution isn’t good because:

  • we introduce unnecessary level of aggregation and loose an ability to pass separate values
  • we can’t inherit only the data cotext while overriding the meta
  • meta context should not be inheritable

Data-contexts and meta contexts should be an orthogonal paths to deliver data into templates.
Also in our team we have a strong belief that this feature lies on the way to the true components in meteor.

MDG, what’s your throughts?


There is a discussion about the future of template arguments and context here. You might want to participate.


@Steve, thanks for pointing into that discussion. Is hackpad, not forums the main place for such (architectural) discussions?


If you prefer, I think you can also discuss on this topic.