how to escape <> in javascript underscore template?

后端 未结 1 1608
独厮守ぢ
独厮守ぢ 2021-01-05 12:25

when using underscore template i want to interpolate a value in anchor\'s href attribute like

a(href= \"<%= id %>\", class=\'products\') //underscore t         


        
相关标签:
1条回答
  • 2021-01-05 13:09

    Use != instead of = to unescape.

    In your case:

    a.products(href!="<%= id %>")
    
    0 讨论(0)
提交回复
热议问题