Using Angular 5 and Firebase, I have created a review website that allows users to create reviews on the CreateComponent
and read them on the ReviewComponent
. I'd like the body of the review to be able to contain HTML for links or images.
The ReviewComponent
pulls the body of the review with:
<p style="margin-bottom: 2rem; white-space: pre-wrap;">{{review.body}}</p>
I am using pre-wrap
to maintain the body's line breaks.
An example input from the CreateComponent
would be:
I already can’t wait to see <a href="http://www.ign.com/articles/2017/11/30/marvels-the-avengers-infinity-war-trailer-breakdown"> what comes next.</a>
When I inspect the output of the body I see this:
<p _ngcontent-c1 style="margin-bottom: 2rem; white-space: pre-wrap;">I already can’t wait to see <a href="http://www.ign.com/articles/2017/11/30/marvels-the-avengers-infinity-war-trailer-breakdown">what comes next.</a></p>
.
How can I change the HTML to enable the string to work correctly with links and images?