Javascript object not working as image source in main.htm

Hi,

The following code does not work in main.htm in a code studio widget: I can’t see any reason why it should not.

image

This is displayed on the page:

image

If I take away the tag, the output is as below (using JSON.stringify in main.js):

If I use the tag in main.htm with the above output without using the JSON reference, it works i.e. the image is displayed on the webpage:

Thanks for any advice,

Mark

Hi Mark,

As this is Vue.js you will need to bind to a variable to use in this way.

For example

v-bind:src=“image_field_value”

or the shorthand

:src=“image_field_value”

Carl

3 Likes

@carl.robinson’s answer is correct

Thanks again Carl. Now working :slight_smile:

For further reference you can find out about Attribute binding here: Template Syntax | Vue.js

1 Like