$...">

Grail interferes with jquery-tmpl syntax

The jQuery template plugin uses the syntax ${foo}( example in the jquery.tmpl file ):

$.tmpl( "<li>${Name}</li>", myData )

But Grails also uses it ( example in a Grails document ):

<body>
  Hello ${params.name}
</body>

So, when I include $.tmpl( "<li>${Name}</li>", myData )in my .gsp, Grails displays it as $.tmpl( "<li></li>", myData );.

Is there an easy way around this?

+3
source share
4 answers

use the syntax alt: {{= Name}}

http://api.jquery.com/template-tag-equal/

+6
source

I only tried in Grails, but one option for getting a literal:

$.tmpl("<li><%='${Name}'%></li>", myData)
+2
source

jquery.noConflict jQuery:

jQuery.tmpl( "<li>${Name}</li>", myData )

var jqc = jQuery.noConflict();
jqc.tmpl( "<li>${Name}</li>", myData )
0

, , zack. :

{{= Name}}

"=" .

< >= {{}}

{{= }}

:

<tr id="ad{{=idmatchingtem }}"></tr>

enter image description here

RIGHT

<tr id="ad{{= idmatchingtem }}"></tr>

enter image description here

0
source

Source: https://habr.com/ru/post/1768336/


All Articles