displaying array contents with text node

2,052 views
Skip to first unread message

daisuke baba

unread,
May 31, 2017, 12:15:32 AM5/31/17
to node...@googlegroups.com
Hi there,

I'm having trouble with "text node" (Node-RED Dashboard widget).
I'd like to show a property value of an object in array with the node.

I set the following values to the text node.

Label: {{payload[0].label }}
Value format: {{payload[0].value}}

And when the payload is [{label:'abc',value:123}] (not text but a json object), the node displays nothing. everything is blank.
But when I set Label to {{payload}}, it shows the json string.

Is there any way to show an object property inside an array in Text Node?
In the past version of the dashboard UI, i think it worked, weird.

Node-RED version: 0.16.2
Dashboard version: 2.3.11
Example flow:
[{"id":"4cec320f.754bdc","type":"debug","z":"4e83c84c.b35b88","name":"","active":true,"console":"false","complete":"payload[0].label","x":618.5,"y":202,"wires":[]}]

Glenn

unread,
May 31, 2017, 12:22:17 AM5/31/17
to Node-RED
This should help

In the template node I use ng-repeat for displaying objects.

Eg

<p ng-repeat="x in msg.payload">{{x.value}}</<p>

daisuke baba

unread,
May 31, 2017, 12:29:54 AM5/31/17
to node...@googlegroups.com
Thanks, using a UI template node seems to be a good alternative.

I also found that Dashboard 2.3.9 showed the property values in text node.
So it looks like a bug...


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/48c6e972-1488-4265-8a73-83dd120e0197%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages