I have the following jQuery template, which I want to display a drop down list for all the values in an enum. I can get the numeric value of the enum, but not the name. Is it possible to get the name? Below is the important snippets of the code - it displays 4 options in the drop down list, with the correct integer value for "value", but nothing for name. I've tried ${$key} as well, but I'm assuming I'm just missing some syntax?
Javascript enum:
var LayoutEnum = Object.freeze(
{
NotDefined: 0,
OneTier: 1,
TwoTier: 2,
ThreeTier: 3,
});
jQuery template:
<script id="Layout_template" type="text/x-jQuery-tmpl">
<div class="row-fluid">
<div class="control-group span4">
<label>Layout:</label>
<div class="controls">
<select id="LayoutControl">
{{each LayoutEnum }}
<option value="${$value}">${$name}</option>
{{/each}}
</select>
</div>
</div>
</div>
</script>