I’m trying to use a switch statement on itemValue to show a consistent on/off state for an item which can have various different values depending on where it was set (note I’m using a custom widget for this). The below seems to always show ?? no matter what the state. Am I doing it right?

    <div ng-switch on="itemValue(config.light_item)">
      <div ng-switch-when="1|On|on" ng-switch-when-separator="|">on</div>
      <div ng-switch-when="0|Off|off" ng-switch-when-separator="|">off</div>
      <div ng-switch-default>??</div>

afaik if should be ON or OFF, as these are the states of a switch item.

@Udo_Hartmann thanks. In this instance I’m using a template (actually custom widget) and the value is coming in from an MQTT server which is set by different software, so not always possible to know what format it will be in (which is why I’d like to use a switch statement like above).

It appears ng-switch-when-separator is new in AngularJS 1.5.9 which just came out a week ago.
HABPanel uses 1.5.8 currently. It’ll be updated soon.

@ysc, thankyou hadn’t realised it was a new feature in angular!

@mattwire I updated AngularJS to 1.5.9 tonight, so your template above with ng-switch-when-separator should work better when you update to the newest version.