0
我有一個像這樣的freemarker宏。Freemarker:從JavaScript函數調用宏
<#assign xmlNode = parseXML("<field name='dropDown' type='select' valueName='COUNTRY'/>")>;
<#import "utilFields.ftl" as util />
<div>
<@util.createDropdown field=xmlNode/>
</div>
如何從Javascript中調用相同的宏?
嘗試:
<#assign xmlNode = parseXML("<field name='dropDown' type='select' valueName='COUNTRY'/>")>;
<script type="text/javascript">
var dropdown = "${util.createDropdown(xmlNode)}";
alert(dropdown);
</script>
錯誤
FreeMarker template error:
A macro cannot be called in an expression.
謝謝@ddekany。這真棒。 –