user3142695
user3142695

Reputation: 17332

meteor template: parse html content

I saved some HTML-content in my collection. By using IronRouter data() will be used to set the cursor/array. In this example I just show an example array.

Now the HTML-content isn't shown correctly, as it doesn't get parsed. The user would see the HTML-tags. What do I have to do to get the content displayed correctly?

IronRouter

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

template

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

Upvotes: 0

Views: 131

Answers (1)

J&#246;rg
J&#246;rg

Reputation: 56

Use Handlebars triple-stash:

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

Upvotes: 2

Related Questions