jeremy
jeremy

Reputation: 433

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?

Upvotes: 0

Views: 1399

Answers (2)

Daniel W.
Daniel W.

Reputation: 563

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.

Upvotes: 3

Wasif Khan
Wasif Khan

Reputation: 954

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

Upvotes: 0

Related Questions