Created
December 19, 2013 10:34
-
-
Save Torsten85/8037304 to your computer and use it in GitHub Desktop.
When directly referencing a template in the inclusion tag, the templating engine reactively updates this template. If a helper method that returns a template component is used, the template is rerendered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>template</title> | |
</head> | |
<body> | |
{{> testB}} | |
</body> | |
<template name="testA"> | |
{{#each items}} | |
{{> item}} | |
{{/each}} | |
</template> | |
<template name="testB"> | |
{{#each items}} | |
{{> getTemplate}} | |
{{/each}} | |
</template> | |
<template name="item"> | |
{{name}}<br> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.isClient) { | |
var Items = new Meteor.Collection('items', {connection: null}); | |
var id = Items.insert({name: 'Test Item'}); | |
setTimeout(function () { | |
Items.update({_id: id}, {name: 'Updated Test Item'}); | |
}, 2000); | |
Template.item.rendered = function () { | |
// This should only trigger once. | |
console.log('Item rendered from scratch'); | |
}; | |
Template.testB.getTemplate = function () { | |
return Template['item']; | |
}; | |
UI.body.items = function () { | |
return Items.find(); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment