I am attempting to embed a property from Spring's application.properties into JavaScript.
It is working properly with the following code:
<h1 th:utext="${@environment.getProperty('key')}"></h1>
However, it returns null with this code:
<script th:inline="javascript">
/*<![CDATA[*/
...
var user = /*[[${key}]]*/ null;
...
/*]]>*/
</script>
What is the correct syntax for embedding properties? Whenever I try using @environment inside the script tag, I encounter an error:
Error: $compile:tpload
Error Loading Template