【发布时间】:2014-10-30 22:27:00
【问题描述】:
助手应该查找主题标签并将它们设为路由/链接。相反,它使文本不显示。我该如何解决这个问题?
代码如下:
handlebar.js
Handlebars.registerHelper('hashtag', function(posttext) {
posttext.html();
posttext = posttext.replace(/#(\w+)/g, "<a href='https://www.google.com/?q=$1' target='_blank'>$&</a>");
posttext.html(posttext);
});
postidem.js
<h3 class="text">{{hashtag title}}</h3>
<p class="text">{{hashtag posttext}}</p>
【问题讨论】:
标签: javascript html meteor meteor-helper