i want to use if then else in hbs file, if {{NumLikes}} is greater than 0 then 1st image else 2nd image, so how i can use if then else in hbs template file using backbone.js.
我尽我所能但不能成功,所以任何身体都可以帮助我解决这个问题。 还想在真假的基础上改变按钮标题的标题。
<div>
< div class="comm-tab-row">
<div class="post-left-panel">
<div class="post-image-container">
<img src="{{UserImageURL}}" alt="" class="post-image" /></br>
<% if ({{NumLikes}} = 0) { %>
<img src="images/myCommunity/like@2x.png" width="20" height="19" id="like-btn" name = "like-Button" >
<% } else { %>
<img src="images/myCommunity/liked@2x.png" width="20" height="19" id="like-btn" name = "like-Button" >
<% } %>
({{NumLikes}})
</div>
</div>
<div class="post-body">
<h5 class="comm-tab-heading">
<span class="navigate-screen" id="{{Id}}" style="text-decoration:underline;">
{{UserName}}
</span>
<span>
-
</span>
<span>
{{format_date Time ""}}
</span>
</h5>
{{Message}}
</div>
<div class="comm-right-panel">
<a href="javascript:void(0);" class="btn-follow" name = "follow-button">FOLLOW</a>
<a href="javascript:void(0);" class="btn-comment" name = "comment-button">{{NumComments}} - COMMENT</a>
</div>
</div>
</div>
</div>