[Solved] Custom habpanel-widget sends command to wrong item

I’m in the process of making an alarmpanel widget where I enter a numeric code that gets posted to an item for processing. I’ve got the html-part of the widget workinig, but when the value is posted it gets sent to the wrong item.

In the widget i have

  			<button class="glyphicon glyphicon-ok" style="margin-top:-1px;" ng-click="sendCmd(Code, code)"></button>

But the logs show:

2017-07-20 22:23:00.570 [WARN ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Test' with an invalid status value '1234'.

At first I tried to use the widget settings to set the item, when that didn’t work I hard-coded the item name into the widget - but with the same result.

Also, it initially posted to yet another item, but changed after i restarted openhab. Still not the right one though…

Using the REST API to make the same POST works as it should.

Edit: I exported the widget and imported it into another panel config, and there it posts to a different item. :confused:

Stupid me, I just realized that the item should be in quotes:

sendCmd('Code', code)