I'm trying out jsRender.
What I want to do:
JS template:
<script id="theaterTemplate" type="text/x-jquery-tmpl">
{{*
if ("{{=theaterId}}" == getCurrentTheaterId()) {
}}
<a class="active" href="#">
{{*
} else {
}}
<a href="#">
{{* } }}
{{=theaterName}}
</a>
</script>
In other JS:
function getCurrentTheaterId() {
return "523";
}
Basically, in the template, if the current theater id in iteration matches what's returned from the js function, then set the class to active. The "{{=theaterId}}" breaks in the if condition. I guess you're not allowed to access current json properties in the if condition.
Any ideas on how to do this?
Hopefully that makes sense. Thanks!