[英]How Do I Change a Meteor Template Dynamically?
Is there a way to change a Meteor Template dynamically with a helper Variable? 有没有一种方法可以使用辅助变量动态更改流星模板?
Example: 例:
templateChanger.html templateChanger.html
<template name="templateChanger">
{{> iWantToChangeThis}}
</template>
templateChanger.js templateChanger.js
Session.set("activeTemplate", "someTemplate");
Template.templateChanger.helpers({
iWantToChangeThis:function(){
return Session.get("activeTemplate")
}
});
Desired Result: 所需结果:
{{> someTemplate}} is loaded {{> someTemplate}}已加载
<template name="templateChanger">
{{> Template.dynamic template=iWantToChangeThis}}
</template>
http://docs.meteor.com/#/full/template_dynamic http://docs.meteor.com/#/full/template_dynamic
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.