I want to have an alert pop up that uses alert() method. I have an example and it works fine when using ngclick. However when I try to pass a msg.payload to the template the pop up will not show until I click on the browser page. I am using a Chrome browser.
Here is the test flow...
[{"id":"178e0660b6026254","type":"ui_template","z":"87abe99bc8ef43df","group":"3027907fd56be4b6","name":"","order":7,"width":"6","height":"2","format":"\n<!DOCTYPE html>\n<html lang=\"en\">\n \n<body>\n <h1 style=\"color: green;\">\n Alert Test\n </h1>\n\n \n<button onclick=\"myalert()\">\n Show Alert Message\n </button>\n\n \n<script>\n function myalert() {\n alert(\"Flex 6700 On\");\n }\n </script> \n\n <script>\n (function(scope) {\n scope.$watch('msg.payload', function(data) {\n // function myalert() {\n // alert(data);\n // }\n // myalert();\n alert(data);\n });\n })(scope);\n </script>\n\n</body>\n \n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":620,"y":360,"wires":[[]]},{"id":"f1aa957df4a04c7c","type":"inject","z":"87abe99bc8ef43df","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"*/1 0 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"On","payloadType":"str","x":450,"y":360,"wires":[["178e0660b6026254"]]},{"id":"3027907fd56be4b6","type":"ui_group","name":"Default","tab":"29dca734fc93f2ac","order":1,"disp":true,"width":"6","collapse":false},{"id":"29dca734fc93f2ac","type":"ui_tab","name":"Alert","icon":"dashboard","disabled":false,"hidden":false}]
Thanks in advance.