Mage
(Szilard)
July 29, 2017, 11:44pm
1
Hello Guys, this HABPanel script doesnt want to work. The goal would be to make ‘open’ red and ‘closed’ green.
But all items are green. Any idea where the issue is?
<tr ng-repeat="item in itemsInGroup('Windows')">
<td class="text-left">{{item.label}}</td>
<td class="text-right" ng-style="{color: (item.state=='open')?'red':'green'}">
{{item.state}}
</td>
</tr>
KidSquid
(The Squid)
September 7, 2018, 5:50am
2
Was there ever an answer for this? This is exactly what I am looking to do.
Thanks,
Squid
Mage
(Szilard)
September 7, 2018, 10:57am
3
Yes. Case sensitive. Try with “OPEN”.
KidSquid
(The Squid)
September 7, 2018, 4:26pm
4
Thanks for the assistance…worked perfectly.
KidSquid
(The Squid)
September 8, 2018, 6:19am
5
Well, I spoke too soon!
It changed the color…but it did not change based on state…
Here’s my code…any suggestions?
<div ng-init="ServerPath='/static/'">
</div>
<style>
.icon {
height: 100px;
}
.gstatus {
font-size: 30px;
}
.thermocolor {
fill: orange;
height: 35px;
}
</style>
<h4>Right Garage Door</h4>
<h2 class=gstatus ng-style="{color: (RtGarageDrSensor.state=='OPEN')?'red':'#00FF00'}"> <img class=icon src={{ServerPath}}hab_icons/garage.svg>{{itemValue('RtGarageDrSensor')}} </h2>
I’ve tried many different case versions of the word OPEN (Open, open) with no luck.
KidSquid
(The Squid)
September 10, 2018, 5:03am
6
Any Angular folks care to offer a suggestion???
ysc
(Yannick Schaus)
September 10, 2018, 12:16pm
7
<h2 class="gstatus" ng-style="{color: (itemState('RtGarageDrSensor')=='OPEN')?'red':'#00FF00'}"> <img class=icon src={{ServerPath}}hab_icons/garage.svg>{{itemState('RtGarageDrSensor')}} </h2>
1 Like
KidSquid
(The Squid)
September 10, 2018, 9:06pm
8
ysc:
<h2 class=“gstatus” ng-style=“{color: (itemState(‘RtGarageDrSensor’)==‘OPEN’)?‘red’:‘#00FF00 ’}”> <img class=icon src={{ServerPath}}hab_icons/garage.svg>{{itemState(‘RtGarageDrSensor’)}} </h2>
Thank you very much!!! - works like a champ!