-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Building Single-page Web Apps with Meteor
By :
Now that we've seen how we can display data using a helper, let's see how we can set the whole data context of a template:
For the next examples, we will create a file called examples.html in our my-meteor-blog/client/templates folder and add the following code snippet:
<template name="contextExample">
<p>{{someText}}</p>
</template>Now that we have our contextExample template, we can add it to our home template by passing some data as follows:
{{> contextExample someText="I was set in the parent template's helper, as an argument."}}This will show the text in the contextExample template because we were displaying it using {{someText}}.
Remember that filenames don't really matter as Meteor is collecting and concatenating them anyway; however, the template name matters since we use this to reference templates.
Setting the context in HTML is not very dynamic, as it is hardcoded. To be able to dynamically change the context,...
Change the font size
Change margin width
Change background colour