简体   繁体   中英

Edit/Create Handlebar with Javascript in Meteor

I looked through the Handlebars documentation which is rather incomplete and found nothing on this. Does anybody know how one would create a Handlebar template with Javascript alone? The only way I know of creating a template currently is with the HTML below. Handlebars.compile will not work in Meteor do to the type of Handlebars used.

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

I want to make a new template, such as 'bar', with Javascript alone (In Meteor). And, after creating said template, how would I obtain the current HTML inside of it and edit it?

Thanks.

弄清楚了:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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