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

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

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

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

image

Hi,

you have to use following notation:

<div ng-bind-html="{{msg.html}}"></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

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.

1 Like

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

If i use the following code

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

the page is empty.

if i use following code

 {{msg.html}}

the page shows only the string.

image

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 ```)

``` 
   code goes here 
```

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

See this post for more details - How to share code or flow json

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

The code is now working thanks a lot.

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

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