node-swig / swig-templates

Take a swig of the best template engine for JavaScript.
http://node-swig.github.io/swig-templates/
MIT License
209 stars 29 forks source link

pass js value inside swig variable #39

Closed Ikhan closed 7 years ago

Ikhan commented 7 years ago

Hi I'm having passing js value inside the swig variable. Is there any way of doing it. Thanks.

Currently I'm doing like this

Thanks.

Markkos89 commented 7 years ago

<script> $(function(){ if(variable == 'something'){ {%set n = variable %} } }); </script>

here you have one blank space missing, try with the blank space

<script> $(function(){ if(variable == 'something'){ {% set n = variable %} } }); </script>