Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 使用Handlebar实时编译json html字符串_Ruby On Rails_Ember.js_Handlebars.js - Fatal编程技术网

Ruby on rails 使用Handlebar实时编译json html字符串

Ruby on rails 使用Handlebar实时编译json html字符串,ruby-on-rails,ember.js,handlebars.js,Ruby On Rails,Ember.js,Handlebars.js,我想有一个“博客”页面的故事,这不是一个完整的博客。我的模型在Rails中包含一个标题和一个主体。 在博客页面中,我通过一个ajax请求获得了各种帖子,我想我可以通过Ember.handlebar.compile编译body live的结果 App.BlogPostView = Ember.View.extend({ template: Ember.Handlebars.compile('<h1>{{title}}</h1>{{body}}') }); App.Bl

我想有一个“博客”页面的故事,这不是一个完整的博客。我的模型在Rails中包含一个标题和一个主体。 在博客页面中,我通过一个ajax请求获得了各种帖子,我想我可以通过Ember.handlebar.compile编译body live的结果

App.BlogPostView = Ember.View.extend({
  template: Ember.Handlebars.compile('<h1>{{title}}</h1>{{body}}')
});
App.BlogPostView=Ember.View.extend({
模板:Ember.handlebar.compile({{title}}{{{body}}})
});
它在一定程度上运行良好,因为我希望对主体部分中的标记也进行编译。然而,我得到的结果是:

第一个职位
第一段

第二职位

另一篇带有标签的帖子


直接在
编译
中的标记被转换成预期的html标记,但其余的标记按字面意思进行处理。

解决方案是使用{{{{body}}}而不是{{body}}

太好了。现在请将您的答案选为已选答案。:-)
<p>first paragraph</p>
<p class="lead">another post with tags</p>