开发者

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

开发者 https://www.devze.com 2023-03-03 06:55 出处:网络
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://jsfidd

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

精彩评论

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