我在初始输入msg.payload的循环中创建复选框(请参阅下面的代码,该代码正常工作)。 进入有效载荷的示例: msg.payload = [{ “NAME”: “一个”},{ “NAME”: “B”}]
<form>
<fieldset style="width:85%">
<legend>choose chartdata</legend>
<div ng-repeat="x in msg.payload">
<input type="checkbox" name={{msg.payload[$index].NAME}}>
<label for={{msg.payload[$index].NAME}}>{{msg.payload[$index].NAME}}</label>
</div>
</fieldset>
</form>
我正在尝试为每个复选框(在更改时)输出一个输出msg.payload(要推送到流程),其中包含复选框的名称(此处为“a”或“b”)和状态(选中/未选中)。
有人知道如何做到这一点吗?
p.s。:流程:
[{"id":"3bbd849e.391734","type":"inject","z":"256e6f3d.da9f7","name":"","topic":"","payload":"[{\"NAME\":\"a\"},{\"NAME\":\"b\"}]","payloadType":"json","repeat":"","crontab":"","once":false,"x":341.08331298828125,"y":216.08334350585938,"wires":[["f6bae45e.b99088"]]},{"id":"f6bae45e.b99088","type":"ui_template","z":"256e6f3d.da9f7","group":"34890ec3.1f4b6a","name":"checkbox","order":11,"width":"3","height":"8","format":"<form>\n <fieldset style=\"width:85%\">\n <legend>choose chartdata</legend>\n <div ng-repeat=\"x in msg.payload\">\n <input type=\"checkbox\" name={{msg.payload[$index].NAME}}>\n <label for={{msg.payload[$index].NAME}}>{{msg.payload[$index].NAME}}</label>\n </div>\n </fieldset>\n</form>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":513.4889526367188,"y":217.39315795898438,"wires":[[]]},{"id":"34890ec3.1f4b6a","type":"ui_group","name":"Group 1","tab":"a52427c4.c3901","order":1,"disp":true,"width":6},{"id":"a52427c4.c3901","type":"ui_tab","z":"","name":"test","icon":"dashboard","order":12}]
答案 0 :(得分:1)
此代码似乎有效:
list_1[1]
取消选中“从输入中传递消息。”和“将输出消息添加到存储状态”。在ui_template