meteor - Retrieving HTML from MongoDB for use in Template -
i'm new meteor.js , mongodb question might have obvious solution missing far searches have turned nothing.
my first meteor project bare-bones blog. in mongodb have following:
blog.insert({ author: "name here", title: "title here", headerhtml: "this <b>very</b> first blog post.", bodyhtml: "what drives <em>solve</em> these types of problems?", date: new date() }); then in blog.js have:
if (meteor.isclient) { meteor.subscribe("blog"); template.posts.entry = function () { return blog.find({}); }; } and in html have following
... <div class="row"> {{> posts}} </div> ... <template name="posts"> <div class="span12"> {{#each entry}} {{author}} {{date}} {{title}} {{headerhtml}} {{bodyhtml}} {{/each}} </div> </template> when have app running sections specified {{headerhtml}} , {{bodyhtml}} return literal string. see tags in text. want string treated html , displayed such. text bolded, have links, etc... wisdom can throw way?
i've tried putting handlebars in various html tags (like <p>{{bodyhml}}</p>) no luck.
use 3 brackets {{{ }}} tell meteor not escape html strings.
{{{headerhtml}}} {{{bodyhtml}}}
Comments
Post a Comment