# Binding HTML code to dashboard 2.0 template doesn´t work as in dashboard

**URL:** <https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [9 April 2024 06:20 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092 "2024-04-09T06:20:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobs](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@nobs](https://discourse.nodered.org/u/nobs)\
**Post date:** [9 April 2024 06:20 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092/1 "2024-04-09T06:20:26Z")

</div>

I wanted to convert my old dashboard to dashboard-v2. The following code is in a template node of the old dashboard .

```auto
<div ng-bind-html="msg.html"></div>

```

in the variable msg.html is a Html page for example:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/5/85cabcd76c2b7bc359e01a6d730e0dd9290170d7.png)

---

<div class="post-metadata">

**Author:** ![Nodey](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@Nodey](https://discourse.nodered.org/u/Nodey)\
**Post date:** [9 April 2024 06:32 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092/2 "2024-04-09T06:32:03Z")

</div>

Hi,

you have to use following notation:

```auto
<div ng-bind-html="{{msg.html}}"></div>

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 April 2024 06:42 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092/3 "2024-04-09T06:42:09Z")

</div>

Dashboard 2.0 uses Vue. What you have in your screenshot is angularjs which Dashboard 1 is written for.

If you search the label #dashboard-2 you will find many examples. Here is a basic one to get you started: [Simple Dashboard 2.0 Template node example](https://discourse.nodered.org/t/simple-dashboard-2-0-template-node-example/86946)

As for binding html, there are many hundreds of thousands of articles about "Vue bind html" around the web but to get you started, here is an example `<p v-html="html"></p>`

* * *

In future, please do not post pictures of code, simply post the code in a code block instead. Thank you.

---

<div class="post-metadata">

**Author:** ![nobs](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@nobs](https://discourse.nodered.org/u/nobs)\
**Post date:** [9 April 2024 06:58 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092/4 "2024-04-09T06:58:59Z")

</div>

I am not free in coding with Vue. The HTML code comes from the DWD weather node.

If i use the following code

```auto
<div ng-bind-html="{{msg.html}}"></div>

```

the page is empty.

if i use following code

```auto
 {{msg.html}}

```

the page shows only the string.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/64c0ac771547f6859de28c72ca26facb47bf050b.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 April 2024 07:01 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092/5 "2024-04-09T07:01:46Z")

</div>

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 April 2024 07:03 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092/6 "2024-04-09T07:03:08Z")

</div>

> [@nobs](#):
>
> if i use following code
> 
> ` {{msg.html}}`
> 
> `the page shows only the string.`

For VUE (which dashboard 2 uses), you need to use `v-html` syntax

> [@Steve-Mcl](#):
>
> As for binding html, there are many hundreds of thousands of articles about "Vue bind html" around the web but to get you started, here is an example `<p v-html="html"></p>`

---

<div class="post-metadata">

**Author:** ![nobs](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@nobs](https://discourse.nodered.org/u/nobs)\
**Post date:** [9 April 2024 07:33 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092/7 "2024-04-09T07:33:03Z")

</div>

The code is now working thanks a lot.

```auto
<p> <span v-html="msg.html"></span></p>

```

---

<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:** [23 April 2024 07:33 UTC](https://discourse.nodered.org/t/binding-html-code-to-dashboard-2-0-template-doesn-t-work-as-in-dashboard/87092/8 "2024-04-23T07:33:32Z")

</div>

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