What is the difference between <%, <%=, <%# and -%> in ERB in Rails?

前端 未结 7 1646
一向
一向 2020-11-21 05:33

Can some one please describe the usage of the following characters which is used in ERB file:

<%   %>
<%=  %>
<%  -%>
<%#  %>
         


        
7条回答
  •  一生所求
    2020-11-21 05:49

    I've added the <%% literal tag delimiter as an answer to this because of its obscurity. This will tell erb not to interpret the <% part of the tag which is necessary for js apps like displaying chart.js tooltips etc.

    Update (Fixed broken link)

    Everything about ERB can now be found here: https://puppet.com/docs/puppet/5.3/lang_template_erb.html#tags

提交回复
热议问题