Backbone.js 如果then else不处理hbs模板文件

Backbone.js 如果then else不处理hbs模板文件,backbone.js,Backbone.js,我尽了最大的努力但没有成功,所以任何人都可以帮助我解决这个问题。 也要在true false的基础上更改按钮标题的标题 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. 您需要双等号来计算变量:''

我尽了最大的努力但没有成功,所以任何人都可以帮助我解决这个问题。 也要在true false的基础上更改按钮标题的标题

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.

您需要双等号来计算变量:''if{{NumLikes}}==0',我正在使用handelbar作为模板。可能的重复项
 <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>
                         - &nbsp;
                    </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>