ng-hide不隐藏按钮

时间:2018-11-22 17:44:51

标签: angularjs ng-hide

如果它是删除文件夹,我想隐藏该按钮,并显示它是否是收件箱。下面的代码不起作用,因为该按钮始终显示。

<div class="message-footer-height"  >
   <div class="custom-div-class" ng-click=""  > 
      <button class="custom-btn-default" 
         ng-hide="messageState.details && itemTappedValue = 'delete'"
         ng-class="{ 'msg-btn' : userMessageDetails.id === -1 }" 
         ng-click="deleteMessage()" >
            {{"button.delete"|translate}}
      </button>
   </div>
</div>

谢谢

2 个答案:

答案 0 :(得分:2)

您需要使用====是宽松的平等,而===是严格的平等。在此处https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness

了解更多
  <div class="message-footer-height"  >
    <div class="custom-div-class" ng-click=""> 
      <button class="custom-btn-default" 
        ng-hide="messageState.details && itemTappedValue == 'delete'"
        ng-class="{ 'msg-btn' : userMessageDetails.id === -1 }"
        ng-click="deleteMessage()">
          {{"button.delete"|translate}}
      </button>
    </div>
  </div>

答案 1 :(得分:1)

这里itemTappedValue = 'delete'

需要双等号