Last active
August 29, 2015 14:01
-
-
Save mhinton/1365c9c7d2355e83ed85 to your computer and use it in GitHub Desktop.
Meteor: Trying to dynamically render a template
This file contains 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
Template.gem_view.context = function() { | |
return { | |
contentTemplate: "gems" | |
}; | |
}; | |
Template.page.render_content = function() { | |
var context = this; | |
var html = Template.no_template_found; | |
if (context && context.contentTemplate) { | |
if (typeof Template[context.contentTemplate] !== "undefined") { | |
html = Template[context.contentTemplate]; | |
} | |
} | |
return html; | |
} | |
/* here is the template for the code above */ | |
<template name="page"> | |
{{{render_content context}}} | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment