Template not making use of variables

I'm attempting to use the node-red-dashboard template to display an embed that uses to configurable parameters. I have a javascript function that passes those into the template, but I cannot get the template to parse them. Whatever I have n the code, which in this case is {{msg.lat}} and {{msg.long}}, shows up unmodified in the source.

How can I make use of these two variables in this code, which follows?

<!--Now setup the control with the Javascript API -->
<script type="text/javascript">
    // Initialize the control
			m_AstrosphericEmbed.Create("AstrosphericEmbedContainer", {{msg.lat}}, {{msg.long}});


try it as just {{{lat}}} and {{{long}}}

I tried that before, and again just now. It just shows up as {{lat}}, {{long}}.

Both of those variables show up in my object in debug with the correct values. I have also tried {{payload}} and {{msg.payload}} just to be sure there's nothing funky about these two variables.

can you share an export of the flow?

Absolutely. I can't upload it since I'm new and it's too large to paste in, so here it is on pastebin.

The ui-template is not the same as the template (it doesn't support. Mustache syntax)

The ui-template is purely client side so you cannot access msg.anything you have to pass the msg to it. Look at the side by help for the UI template node, there is an example of how to pass a message in.

Alternatively, you can use the standard template node to generate this client side script part then pass that in to the UI template since the standard template node does support the format you are trying to use.

Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.