angularjsng-hide

ng-hide does not hide button


I want to hide the button if it's the delete folder and show if it's the inbox. The code below does not work as the button is always shown.

<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>

Thanks


Solution

  • You need to use ==, == is loose equality and === is strict equality. Read more here 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>