thymeleaf part is not interpreted in js

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

thymeleaf part is not interpreted in js

redfox26
This post was updated on .
I use thymeleaf  and spring In a js function I create a row. Issue is the thymeleaf part is not interpreted so thymeleaf code is still in the code.


<script type="text/javascript" th:inline="javascript">

    function addRow(tableId, letter){

        var row=`
            <tr>
              <td  data-id="${letter}">${letter}</td>
              <td> <input class="" type="checkbox" name="compression"> </td>
              /*[# sec:authorize="hasAnyRole('ROLE_ADMIN', 'ROLE_USER')"]*/   
              <td> <i class="fas fa-trash-alt delete"></i> </td>
              /*[/]*/
             </tr>
              `;
         ...
     } 
</script>

So depending of the role
 <td> <i class="fas fa-trash-alt delete"></i> </td> could be there... but i continue to see thymeleaf in the js generated.
Reply | Threaded
Open this post in threaded view
|

Re: thymeleaf part is not interpreted in js

Reiju
let hasRole = [[${#authorization.expression('hasRole(''ROLE_ADMIN'')')}]];