angularjsng-hide

how to compare 2 string values for ng-hide


I'm trying to compare a value of an object file.name to see if it matches 2 strings but it doesnt seem to be working right. Not exactly sure what i'm doing wrong...is it because i can't compare more than 2 strings in a or comparator like this?

HTML:

<a ng-hide="file.name !== 'application' || 'history application'">
    <span>Hello</span>
</a>

i want to hide if my file names do not equal application or history

any ideas?


Solution

  • While Wasif Khan's answer is correct, it is best practice not to use double negatives where they can be avoided.

    <a ng-show="file.name === 'application' || file.name === 'history application'">
    <span>Hello</span>
    </a>
    

    By using ng-show instead of ng-hide, the code becomes more readable.