简体   繁体   English

在Meteor中使用Java编辑/创建车把

[英]Edit/Create Handlebar with Javascript in Meteor

I looked through the Handlebars documentation which is rather incomplete and found nothing on this. 我浏览了很不完整的Handlebars文档,却没有发现任何东西。 Does anybody know how one would create a Handlebar template with Javascript alone? 有谁知道如何仅使用Javascript创建Handlebar模板? The only way I know of creating a template currently is with the HTML below. 我知道当前创建模板的唯一方法是使用下面的HTML。 Handlebars.compile will not work in Meteor do to the type of Handlebars used. 在Meteor中,Handlebars.compile不适用于所使用的Handlebars类型。

<template name="foo">
Bar
</template>

I want to make a new template, such as 'bar', with Javascript alone (In Meteor). 我想用Javascript(在Meteor中)制作一个新模板,例如“ bar”。 And, after creating said template, how would I obtain the current HTML inside of it and edit it? 并且,在创建了所述模板后,如何在其中获取当前HTML并进行编辑?

Thanks. 谢谢。

弄清楚了:

Template.foo = function(){return "bar";};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM