Hi, I am not good at Angular JS.
I am trying to send an msg.payload after an countdown, see the code below.
<script>
var myTimer;
function clock()
{
var myTimer = setInterval(myClock, 1000);
var c = 20;
function myClock()
{
document.getElementById("demo").innerHTML = --c;
if (c == 0)
{
(function(scope)
{
scope.send({payload: "something"});
})
(scope);
}
}
}
</script>
<p id="demo" align="center">{{msg}}</p>
<br><br>
<button onclick="clock();">>Start counter</button>
[{"id":"1af6dff0.69f998","type":"debug","z":"eb0da159.829678","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":910,"y":60,"wires":[]},{"id":"c659cd6c.0564c","type":"ui_template","z":"eb0da159.829678","group":"d8ee9c1c.4e4748","name":"","order":3,"width":"12","height":"8","format":" <script> \n var myTimer;\n function clock() \n {\n var myTimer = setInterval(myClock, 1000);\n var c = 20;\n\n function myClock() \n {\n document.getElementById(\"demo\").innerHTML = --c;\n\n if (c == 0) \n {\n \n (function(scope)\n {\n scope.send({payload: \"something\"});\n })\n \n (scope); \n \n\n }\n }\n }\n\n</script>\n\n<p id=\"demo\" align=\"center\">{{msg}}</p>\n<br><br>\n<button onclick=\"clock();\">>Start counter</button>\n","storeOutMessages":true,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","x":120,"y":60,"wires":[["9d6cd887.ff10a8","1af6dff0.69f998"]]},{"id":"d8ee9c1c.4e4748","type":"ui_group","z":"","name":"FRAMATECH Fight Light","tab":"421e8764.5d6f7","order":1,"disp":true,"width":"12","collapse":false},{"id":"421e8764.5d6f7","type":"ui_tab","z":"","name":"FRAMATECH Fight Light","icon":"dashboard","disabled":false,"hidden":false}]
But it doesnt work because "19:17:36.597 Uncaught ReferenceError: scope is not defined
myClock line 20 > scriptElement:20
ui:20:1
"
Could you help me please?
Thx