Data and option in the same {{if}}
Closed this issue · 6 comments
uhtred commented
When i try to use simple data and $item values in {{if }} conditions, just dont recognize the data value anymore.
Here is a sample:
http://jsfiddle.net/aYSBX/
uhtred commented
BorisMoore commented
<select id="test"></select>
<script id="template-test" type="text/x-jquery-tmpl">
<option value="${cod}" {{if $item.selected != cod}}disabled{{/if}}>${name}</option>
</script>
Works for me and gives
<select id="test"><option value="1" disabled="">test 1</option><option value="2">test 2</option><option value="3" disabled="">test 3</option></select>
uhtred commented
Sorry again http://jsfiddle.net/drfranca/aYSBX/5/
uhtred commented
Give "disabled is not defined". And tks
BorisMoore commented
But disabled is not defined on items 2 and 3. This works without throwing: if $data.disabled... Or define disabled:false on the other data items.
uhtred commented
Excelent! Thank you!