I tried to give you an example where you can change a variable in the rootScope from different ui-templates on different tabs. A watch-function for the rootScope-variable invokes the mdDialog Service. To my opinion this could be a start.
[
{
"id": "0d08b99f23b28073",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "08114bf8a7401901",
"type": "ui_template",
"z": "0d08b99f23b28073",
"group": "",
"name": "header",
"order": 0,
"width": 0,
"height": 0,
"format": "\n\n<script type=\"text/javascript\">\n function generateRandomLetter() {\n const alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n return alphabet[Math.floor(Math.random() * alphabet.length)]\n }\n\n var testShowAlert = function ($mdDialog) {\n var alert = $mdDialog.alert({\n title: 'Attention',\n textContent: 'rootScope.myVar has changed!',\n ok: 'Close'\n });\n \n $mdDialog\n .show( alert )\n .finally(function() {\n alert = undefined;\n });\n }\n\n //Document Object Model (DOM) is ready for JavaScript code to execute\n //==> is executed after the Angular App has been loaded, but before the Template Node functions are executed\n //==> creates angular rootScope variables\n angular.element(async function(){\n try{\n const dashboardElement = angular.element('#nr-dashboard');//get the apps root element\n const injector = dashboardElement.injector();\n const rootScope = injector.get('$rootScope');//get the root scope\n if(!rootScope.hasOwnProperty('myVar')){\n rootScope.$watch('myVar', function(variable){\n if(variable !== undefined && variable !== null){\n injector.invoke(window.testShowAlert,null,null);\n }\n });\n rootScope.myVar = null;\n }\n }catch(err){\n console.error(err);\n }\n });\n \n</script>\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "global",
"className": "",
"x": 880,
"y": 340,
"wires": [
[]
]
},
{
"id": "8fd8d666bda53841",
"type": "ui_template",
"z": "0d08b99f23b28073",
"group": "0675ab3d55da9e2d",
"name": "",
"order": 0,
"width": 0,
"height": 0,
"format": "<script>\n (function(scope) {\n scope.$watch('msg', function(msg) {\n if(msg !== undefined && msg !== null){\n\n try{\n if(!msg.hasOwnProperty('old')){\n msg.old = true;\n switch(msg.topic) {\n case \"button\":\n console.log('change');\n scope.$root.myVar = window.generateRandomLetter();\n scope.send({topic:'myVar', payload:scope.$root.myVar});\n break;\n default:\n break;\n }\n }\n }catch(err){\n console.error(err);\n }\n }\n });\n })(scope);\n</script> ",
"storeOutMessages": false,
"fwdInMessages": false,
"resendOnRefresh": false,
"templateScope": "local",
"className": "",
"x": 880,
"y": 500,
"wires": [
[
"a3693a04261c8768"
]
]
},
{
"id": "77da467d911b5259",
"type": "ui_button",
"z": "0d08b99f23b28073",
"name": "",
"group": "0675ab3d55da9e2d",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"label": "change myVar",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "something",
"payloadType": "str",
"topic": "button",
"topicType": "str",
"x": 620,
"y": 500,
"wires": [
[
"8fd8d666bda53841"
]
]
},
{
"id": "a3693a04261c8768",
"type": "debug",
"z": "0d08b99f23b28073",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1220,
"y": 500,
"wires": []
},
{
"id": "0893a7a04e055afa",
"type": "ui_template",
"z": "0d08b99f23b28073",
"group": "73abbeec4b5a6c38",
"name": "",
"order": 0,
"width": 0,
"height": 0,
"format": "<script>\n (function(scope) {\n scope.$watch('msg', function(msg) {\n if(msg !== undefined && msg !== null){\n try{\n if(!msg.hasOwnProperty('old')){\n msg.old = true;\n switch(msg.topic) {\n case \"button\":\n console.log('change');\n scope.$root.myVar = window.generateRandomLetter();\n scope.send({topic:'myVar', payload:scope.$root.myVar});\n break;\n default:\n break;\n }\n }\n }catch(err){\n console.error(err);\n }\n }\n });\n })(scope);\n</script>",
"storeOutMessages": false,
"fwdInMessages": false,
"resendOnRefresh": false,
"templateScope": "local",
"className": "",
"x": 880,
"y": 620,
"wires": [
[
"90e24c712644684a"
]
]
},
{
"id": "14a669b7763e1813",
"type": "ui_button",
"z": "0d08b99f23b28073",
"name": "",
"group": "73abbeec4b5a6c38",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"label": "change myVar",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "something",
"payloadType": "str",
"topic": "button",
"topicType": "str",
"x": 620,
"y": 620,
"wires": [
[
"0893a7a04e055afa"
]
]
},
{
"id": "90e24c712644684a",
"type": "debug",
"z": "0d08b99f23b28073",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1220,
"y": 620,
"wires": []
},
{
"id": "0675ab3d55da9e2d",
"type": "ui_group",
"name": "Group 1",
"tab": "3f70ba13fa26bc52",
"order": 1,
"disp": true,
"width": 6
},
{
"id": "73abbeec4b5a6c38",
"type": "ui_group",
"name": "Group 1",
"tab": "739ec2e59a06d618",
"order": 1,
"disp": true,
"width": 6
},
{
"id": "3f70ba13fa26bc52",
"type": "ui_tab",
"name": "Tab 1",
"icon": "dashboard",
"order": 1
},
{
"id": "739ec2e59a06d618",
"type": "ui_tab",
"name": "Tab 2",
"icon": "dashboard",
"order": 2
}
]