Inserting Raw HTML

In this lesson, we'll learn how to insert raw HTML.

We saw how Angular takes care of preventing XSS attacks in the previous lesson. It’s something we generally don’t have to worry about. However, there are some cases where we’ll want to insert HTML into the document.

We can do so by binding the innerHTML property on the element. Let’s update the results.component.html template file to see what that looks like.

Get hands-on with 1200+ tech skills courses.