How to get the value of a data item for use in {{if}}?

I am trying to get the value of a data item for use in the {{if}} tag, but cannot make it work. So the question is, how do we get this value? Here you can see the full code http://jsfiddle.net/epitka/BhYvh/

<script id="contentHeaderTemplate" type="text/x-jquery-tmpl"> {{if($data.Id===1)}} Create New Order{{else}}Edit Order {{/if}} <br /> </script> 
+4
source share
2 answers

Release the parentheses.

 {{if $data.Id === 1 }} 

http://jsfiddle.net/mattball/KdqZF/

See also the {{if}} tag tag API page .

+4
source

In this if statement, you do not need parentheses. Try: {{if $data.Id === 1 }}

+4
source

All Articles