2016-01-12 74 views
0

我在我的收藏中保存了一些HTML内容。通过使用IronRouter data()将用于设置游标/数组。在这个例子中,我只是展示了一个示例数组。流星模板:解析html内容

现在HTML内容显示不正确,因为它不会被解析。用户会看到HTML标签。我需要做些什么才能正确显示内容?

IronRouter

Router.route('/article/:_id', { 
    name: 'article', 
    data: function() { 
     var articles = [{ title: 'title', content: '<strong>content</strong>'}]; 
     return { articles: articles }; 
    } 
}); 

模板

<template name="article"> 
    {{#each articles}} 
     <h1>{{title}}</h1> 
     <section>{{content}}</section> 
    {{/each}} 
</template> 

回答

2

使用Handlebars triple-stash

<template name="article"> 
    {{#each articles}} 
    <h1>{{title}}</h1> 
    <section>{{{description}}}</section> 
    {{/each}} 
</template> 
+0

不知道 – user3142695