Pass messages to UI template using Jquery

I am using a UI Template node to to a scope watch to update changes for display. I am currently using this code:

<script>
    (function(scope) {
        //hide this card. NOTE: 4b689f7473831a84 is the Node id as 
        //seen in the INFO panel on the sidebar when you select this node
        $('[node-id="55ef921cfa9dc9cd"]').hide();
        scope.$watch('msg', function(msg) {
            if (msg.topic == "wx") {
                $("#header-thermometer").html("<i class='fa fa-thermometer-half' aria-hidden='true'></i>").css("color",'#98FF55');
                $("#header-temperature").text(msg.temp);
                $("#header-wdirection").html(msg.windir).css("color",'#A6EDF8');
                $("#header-wspeed").text(msg.speed);
                $("#header-wicon").html(msg.wxicon).css("color",'#FBFCB8');
                $("#header-wbar").html(msg.bar).css("color",'#B6B8E2');
            }
        });
    })(scope);
</script>

The only way I could pass a message to the Jquery was by using above format. If I tried to type a command such as:

<i class="wi wi-direction wi-from-{{msg.windir}} wi-1x" style="color:#A6EDF8";>&nbsp</i>

The message was not picked up.. I ended up coding the entire html line as a msg object. The html format works if I hard code the value and use it instead of the .html(msg.object). Is there a way to embed the message in a Jquery html statement?

Regards

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