0
<img src="img/temp.png" class="img-responsive" ng-if="series === 'Temperature' || series === 'T' || series === 'Temperature-138828'">

I tried like this, but it didn't work:

<img src="img/temp.png" class="img-responsive" ng-if="series === ('Temperature' || 'T' || 'Temperature-138828')">

Is there a way to shorten this <img> tag (such as to compare series with multiple values or something else?). I haven't used angularjs a lot, so any advice would be appreciated.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
manvi77
  • 536
  • 1
  • 5
  • 15

2 Answers2

0

First of all you should take that compare to a function in controller. You can create constant array there, and check does series in that array.

P.s. TemeratureArray declare as condtant. Use vm, not scope (but in first staps you can try with scope)

SirCapy
  • 295
  • 1
  • 12
0

Try like this:

<img src="img/temp.png" class="img-responsive" ng-if="['Temperature', 'T', 'Temperature-138828'].indexOf(series) > -1">