开发者

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

I am trying to get the value of the data item to use in a {{if}} tag, but cannot get it to work. So, the question is how do we get 开发者_Python百科that value? You can see full code here 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>


Drop the parentheses.

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

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

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


You don't need the parentheses in that if statement. Try: {{if $data.Id === 1 }}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜