Why this works: Meteor-Blaze #with and data context? -
i wonder why following thing outputs 'hello' instead of 'bye'???
template:
<template name="example"> {{#with datacontext}} {{say}} {{/with}} </template>
template helper:
template.example.helpers({ datacontext: function() { return { say: 'bye' }; }, say: function() { return 'hello'; } });
(meteor 1.1.0.2)
the shortest answer helpers have preference on data context.
if rename 1 of them else should solve problem.
the order lookup goes is:
- the data context (if contains
.
).{{say}}
not. - the template's helper.
{{say}}
has helpersay
. - a template
- a global helper such defined
template.registerhelper
. - the data context
so if first isn't found, goes down list until finds something
Comments
Post a Comment