0

My iron-ajax response an object like this:

{
   "id": "1",
   "idcontenido": "7",
   "imagenes": ["carabela.png", "DSC_9565.png"],
   "tipo_imagen": "img-circle",
   "html": "Esta <b>regi\u00f3n<\/b>"
}

Some ids, an array images... and one 'html' attribute.

This is my element template:

<template>
   ...
   <p>[[ajaxResponse.html]]</p>

<iron-ajax 
        id="ajax" 
        url="..." 
        handle-as="json" 
        verbose=true 
        last-response={{ajaxResponse}} 
        loading="{{cargando}}"> </iron-ajax>
   ...
</template>

So I want to write the html code from server in my page, but when showing the page, the html code is not being interpretated and I can read literally:

Esta <b>región</b>

How can I fix this interpretated the html code? Thanks!

Jaime
  • 328
  • 1
  • 6
  • 19
  • 1
    duplicate: http://stackoverflow.com/questions/22199662/how-to-inject-html-into-a-template-with-polymer/22208332#22208332 – Goce Ribeski Dec 01 '16 at 10:29

1 Answers1

0

Finally I have fix this with an on-response method for the iron-ajax element:

_onResponse: function (e) {
   this.$.html.innerHTML = e.detail.response.html;
}

e.detail.response contains an object with a 'html' attribute, the html code I want to write in my page in a 'p' tag with id=html

Jaime
  • 328
  • 1
  • 6
  • 19