I am facing an issue where I need to add a button to an HTML template that directs users to an external website. However, Google Chrome displays the following warning when reading the HTML:
WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).
It appears that Angular 2's innerHTML attribute does not support recursive HTML bindings.
Below is the code snippet causing the problem:
<ion-col width-80 innerHtml="{{ slide.content + '<p><button round full (click)=`'
+ slide.button.url +'`>'+slide.button.text+'</button>' }}"></ion-col>
The (click) attribute is getting deleted and only (slide.button.text)
is being displayed as plain text.
Is there any workaround for this issue?
The structure of the slide
object is as follows:
{
img: 'img/picture.png',
content: `sometext`,
button : {
url: `http://www.foo.com`,
text: `Site foo`
}
}