# Running script in dashboard 2.0

**URL:** <https://discourse.nodered.org/t/running-script-in-dashboard-2-0/95194>\
**Category:** Dashboard\
**Created:** [6 February 2025 20:43 UTC](https://discourse.nodered.org/t/running-script-in-dashboard-2-0/95194 "2025-02-06T20:43:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xtrailrunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xtrailrunner/32/74959_2.png) [@xtrailrunner](https://discourse.nodered.org/u/xtrailrunner)\
**Post date:** [6 February 2025 20:43 UTC](https://discourse.nodered.org/t/running-script-in-dashboard-2-0/95194/1 "2025-02-06T20:43:05Z")

</div>

Hi,  
in this [post](https://discourse.nodered.org/t/how-to-display-output-of-script-in-dashboard/93943/4) I've asked how to run a script in dashboard.  
Finally I succeed with the following code:

```auto
<div id="weather-widget-container"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/postscribe/2.0.8/postscribe.min.js"></script>
<script>
    (function(scope) {
        scope.$watch('msg.payload', function(value) {
            if (value) {
                setTimeout(() => { // Verzögerung einbauen
                postscribe('#weather-widget-container', value);
                }, 100); // 100 Millisekunden warten
            }
        });
    })(scope);
</script>

```

Now I want to get it running in the new dashboard 2.0.  
But here the output of the widget is not visible.  
Any help is appreciated.  
Kind regards  
Juergen

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [6 February 2025 20:49 UTC](https://discourse.nodered.org/t/running-script-in-dashboard-2-0/95194/2 "2025-02-06T20:49:15Z")

</div>

You can read all from here. It is a bit different for dashboard 2.

> **[Template ui-template | Node-RED Dashboard 2.0](https://dashboard.flowfuse.com/nodes/widgets/ui-template.html#loading-external-dependencies)**
>
> Harness the power of ui-template in Node-RED Dashboard 2.0 to design custom widgets and unique dashboard layouts.

---

<div class="post-metadata">

**Author:** ![xtrailrunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xtrailrunner/32/74959_2.png) [@xtrailrunner](https://discourse.nodered.org/u/xtrailrunner)\
**Post date:** [6 February 2025 21:13 UTC](https://discourse.nodered.org/t/running-script-in-dashboard-2-0/95194/3 "2025-02-06T21:13:54Z")

</div>

Thanks!  
I've seen this document before I posted my question.  
I have put the div-tag in the template section and the script-tag with the dependency to postscribe into the script section. The payload can either be hardcoded into the template or send via msg.payload. But the div and the output of the script does not appear in the group.  
Regards Juergen

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [7 February 2025 13:59 UTC](https://discourse.nodered.org/t/running-script-in-dashboard-2-0/95194/4 "2025-02-07T13:59:44Z")

</div>

There is no concept of `scope` in Dashboard 2.0. The link that @hotNipi has shared shows an explicit example of how to load a third party script and run it's contents

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 March 2025 14:00 UTC](https://discourse.nodered.org/t/running-script-in-dashboard-2-0/95194/5 "2025-03-09T14:00:24Z")

</div>

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