【问题标题】:HTML not rendering inside JadeHTML 未在 Jade 中呈现
【发布时间】:2015-08-06 09:23:52
【问题描述】:

我正在用node.js、express、angular.js 和jade 构建一个网站。我目前正在测试博客文章上的 html 标签,这似乎不起作用。

我现在专注于标题。为什么浏览器不将其呈现为 HTML?顺便说一句,我在 chrome 中对此进行了测试,但结果相同。这是玉码:

div(ng-repeat='post in posts')
  h3 
    |{{post.title}}

这是 mongodb 记录(相关的):

"title": "<strong>This text is strong</strong>",

我能做些什么来解决这个问题?

【问题讨论】:

    标签: html angularjs node.js express pug


    【解决方案1】:

    尝试使用ngBindHtml 指令:

    div(ng-repeat='post in posts')
      h3 
        span(ng-bind-html-unsafe='post.title')
    

    【讨论】:

    • 然后网站加载空白,因为这是一个角度变量
    猜你喜欢
    • 2017-07-12
    • 2012-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-14
    • 2017-09-04
    • 2016-06-02
    • 2012-01-04
    相关资源
    最近更新 更多