Goran Obradovic
Goran Obradovic

Reputation: 9051

Bind raw html in Aurelia

Using Aurelia, I want to fill an <div> with contents of viewmodel property (lets call it htmlText) which contains html text, and I was using

<div>
${htmlText}
</div>

However, this encodes html so, instead of i.e. having paragraph or link, all tags are escaped so html can be seen as source.

Is there out of the box binder to do this?

Upvotes: 44

Views: 13635

Answers (1)

Matthew James Davis
Matthew James Davis

Reputation: 12295

You can accomplish this using the innerhtml binding like so:

<div innerhtml.bind="htmlText"></div>

Upvotes: 89

Related Questions