Vinod Poorma
Vinod Poorma

Reputation: 449

Node-red how to read global var in template node

Hi I am facing issue at "template" node. I try to access global variable but i am getting error like "global is not defined". please help me..

Upvotes: 3

Views: 6913

Answers (1)

knolleary
knolleary

Reputation: 10117

It depends which template node you are referring to. The core template node allows you to access flow/global context properties. From the help it provides in the information sidebar:

It is possible to use a property from the flow context or global context. Just use {{flow.name}} or {{global.name}}.

This was introduced in Node-RED 0.16 - so has been available for sometime.

If however you are referring to the ui_template node, provided as part of the node-red-dashboard set of nodes, then no, you cannot access context directly and you should use a Change node to attach any context property to the message you pass to the ui_template node.

Upvotes: 10

Related Questions