[SOLVED] itemsWithTags not working

Am I doing something wrong or is there a bug in itemsWithTag …Im on openhab 2.4 and I’ve used restapi to add tags to several items and now trying to use an ng-repeat=“item in itemsWithTag(‘lw_switch’)” to retrieve them but its not finding anything

restapi shows

[
  {
    "editable": true,
    "name": "switch_0_10",
    "tags": [
      "lw_switch"
    ]
  },
  {
    "editable": true,
    "name": "switch_0_11",
    "tags": [
      "lw_switch"
    ]
  }
]

Tracing the code I see that template.widget.js line 93 testing for the items tagNames property

return (item.tagNames && item.tagNames.indexOf(tag) !== -1);

but that doesnt exist in my items the property is called tags
Have I run into a code bug or did I do something wrong in defining my items ?

Thanks

The tags are not accessible in the rules DSL
VS code shows:
Screenshot%20from%202018-12-21%2017-27-28

Thanks Vincent, this is in a habpanel custom widget not a rule. Itemwithtag is a documented function but i cant see how it would work as coded, either it should be looking for tags property or my item schema is returning the wrong name.

I have no idea where this “tagNames” comes from… :astonished: Maybe it was the name of the property in early 2.0 betas then it changed and I didn’t notice. I’ll fix it. Thanks for the report!

Thank you Yannick :grin: