by @CodingExample

Angular HTML binding

Home » angular » Angular HTML binding

This example shows you how to bind html in angular.

<div [innerHTML]="htmlString"></div>

In your component you need to define htmlString property.

import { Component } from "@angular/core";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  htmlString= "<h1>Hello angular</h1><p>good to see</p>";
}