Javascript Coffeescript指令从JSON替换html

Javascript Coffeescript指令从JSON替换html,javascript,json,angularjs,coffeescript,angularjs-directive,Javascript,Json,Angularjs,Coffeescript,Angularjs Directive,我是咖啡脚本和用户定义指令的新手 JSON对象 ["Comments": "Some text &#150; more text"] 数据库在返回的JSON数据中有html连字符“-” 我的指示: @mWebApp.directive 'customerComments', [ -> restrict: 'E', template: '<li>{{ customer.0.Comments }}</li>' ] @mWebApp.directive

我是咖啡脚本和用户定义指令的新手

JSON对象

["Comments": "Some text &#150; more text"]
数据库在返回的JSON数据中有html连字符“-”

我的指示:

@mWebApp.directive 'customerComments', [ ->
  restrict: 'E',
  template: '<li>{{ customer.0.Comments }}</li>'
]
@mWebApp.directive“customerComments”,[->
限制:'E',
模板:“
  • {{customer.0.Comments}}
  • ” ]
    我的公共Html/templates/customers/show.Html

    <customer-comments></customer-comments>
    
    
    
    这就是为什么:

    <customer-comments>
      <li>Some text &#150; more text</li>
    </customer-comments>
    
    
    
  • 一些文字–;更多文本
  • 这很好,除了
    &#150;显示

    我可以使用指令查找
    &#150
    ;在JSON数据中,并在页面上将其替换为实际的连字符或em破折号“-”