成为< br>当从mongodb流星中取出时

时间:2013-06-11 12:58:49

标签: javascript jquery mongodb meteor

我这里有点问题。我的标签变成了< br>相反,当我尝试从mongodb设置标签文本时。

//我的流星方法

Meteor.methods({
  addEventDetails : function(title, details) {
    details=details.replace('\n', "<br>");
    eventDetails.insert({'title': title, 'details': details});
  } 
});

//我的模板功能

Template.detailsboard.evt = function(){
    return eventDetails.findOne({});
  }

//我的模板

<template name="detailsboard">
    <div class="block">
        <div class="navbar navbar-inner block-header">

            <div class="pull-left"><i class="icon-bookmark"></i><span class="block-header-title">Event Details</span></div>
            <div class="pull-right searchbar"></div>
            <!-- <div class="pull-right"><span class="badge badge-warning">View More</span></div> -->
        </div>
        <!-- /block header-->
        <!-- block content -->
        <div class="block-content-details collapse in">
            <ol class="stream-items" id="stream-items-id">
                <a class="logo-details" href="/"></a>
                <div class="row-fluid" style="padding:10%">
                    <div class="span12">
                    <label class="text-inverse details-title">{{evt.title}}</label>
                    **//problem here**
                    <p class="text-inverse details-content">this.html({{evt.details}})</p>

                    </div>
                </div>
            </ol>
        </div>
        <!-- /block content -->
    </div>
    <!-- block header -->
</template>

1 个答案:

答案 0 :(得分:1)

使用三重胡须{{{evt.details}}},因为默认情况下,Handlebars(或最初的Mustache)会转义HTML。