<script id="titleScript" type="text/javascript">
$('#titleScript').parent().hide();
var toolbar = $('.md-toolbar-tools');
var div = $('<div/>');
var p = $('<p/>');
div.append(p);
div[0].style.margin = '5px 5px 5px auto';
var lh = "\"" + {{global.get("lighthouse")}} + "\"";
p.text(lh);
toolbar.append(div);
</script>
Currently you can only get msg and it's properties, so use a previous change node to move it over.
--
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.
For more options, visit https://groups.google.com/d/optout.
move global.get("lighthouse")to msg.payload
var lh = "\"" + {{global.get("lighthouse")}} + "\"";
var lh = "\"" + {{msg.payload}} + "\"";
Currently you can only get msg and it's properties, so use a previous change node to move it over.
On 18 Aug 2016 20:49, "'Robert Linn' via Node-RED" <node...@googlegroups.com> wrote:
Hi,--
in a ui_template node, trying to get the content of a global context displayed in the UI toolbar:but receiving error, that global can not be found. Also tried instead of global, the msg.payload, but same error.<script id="titleScript" type="text/javascript">
$('#titleScript').parent().hide();
var toolbar = $('.md-toolbar-tools');
var div = $('<div/>');
var p = $('<p/>');
div.append(p);
div[0].style.margin = '5px 5px 5px auto';
var lh = "\"" + {{global.get("lighthouse")}} + "\"";
p.text(lh);
toolbar.append(div);
</script>
Instead of {{ }}, tried {{{ }}} or ().
Any hints appreciated.
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+u...@googlegroups.com.
p.text({{msg.payload}});
but still get invalid property id.
The msg.payload has the right content as out put from the Change Node.
I am Node-RED NewBie, any examples appreciated.
<h3>Testing dynamic scripts with Dashboard 2.0</h3>{{msg.payload}}<script> (function(scope) { console.log('Position 1'); console.dir(scope); scope.$watch('msg.payload', function(data) { console.log('Position 2'); console.dir(data); }); })(scope);</script><script id="titleScript" type="text/javascript">
$('#titleScript').parent().hide();
var toolbar = $('.md-toolbar-tools');
var div = $('<div/>');
var p = $('<p/>');
div.append(p);
div[0].style.margin = '5px 5px 5px auto';
function displayTitle(lh) {
p.text(lh);
}
toolbar.append(div);
// Watch the payload and update the title
(function(scope) {
scope.$watch('msg.payload', function(data) {
displayTitle(data);
});
})(scope);
</script>