Hugo , - 0.8 . , , , .
If you may have had {{{resolve}}} in your template, you should:
<template name='thing'>
<ol>
{{#each all}}
{{resolve}}
{{/each}}
</ol>
<template>
Then, in the helper code, Spacebars.SafeString is used, which Blaze prefers:
Template.thing.helpers({
all: function () {
return Things.find();
},
resolve: function () {
var result = "<li>";
for (var i = 0; i < this.arrayOfClassNames.length; ++i)
result += <'div class='" + this.arrayOfClassNames[i] + "'></div>";
result += "</li>";
return new Spacebars.SafeString(result);
}
});
The key here is to return the “new Spacebars.SafeString (result)” to wrap your HTML (which should be well-formed).
source
share