Dear Forum,
I am struggling with quite simple topic. I want to define a button what is highlighted if the item value is equal to the assigned number of the button. I simply can not get it working
The widget in HABPanel works if I compare the item value to the solid number but it does not work if I compare tot the widget variable…
This code works! Look at this comparison in the code:
ng-if="itemValue(config.item) == '3'"
- if the item value is equal
- if the item value is not equal
<style>
.section {
padding: 5px;
margin: auto;
}
.button_number {
border: 1px solid;
border-radius: 10px;
padding: 5px;
margin: auto;
width: 80px;
height: 80px;
background-color: #424242;
}
.button_number_active {
border: 1px solid;
border-radius: 10px;
padding: 5px;
margin: auto;
width: 80px;
height: 80px;
background-color: grey;
}
.text {
text-align: center;
color: #ff9c27;
font-size: 42px;
}
</style>
<div class="section">
<button class="button_number" ng-if="itemValue(config.item) != '3'" ng-click="sendCmd(config.item, config.number)">
<div class="text">{{config.number}}</div>
</button>
<button class="button_number_active" ng-if="itemValue(config.item) == '3'" ng-click="sendCmd(config.item, config.number)">
<div class="text">{{config.number}}</div>
</button>
</div>
Widget settings:
My intention is to compare not the fixed value but the one defined in the widget settings:
This dos not work anymore:
ng-if="itemValue(config.item) == '{{config.number}}'"
This does not work as well
ng-if="itemValue(config.item) == '{{itemValue(config.number)}}'"
I tried to change the variable form number to a string in the widget settings I can not simply get it working. I tried to comere with ’ ’ and without.