In AngularJS, the directive ng-include was used to include HTML content from an external file. This directive does not exist in Angular but can be accomplished using different way.  This tutorial will show 2 Ways to bind HTML with Angular.

Bind HTML using innerHTML attribute

Let’s say our HTML content is within a variable called  htmlTemplate. HTML binding can be done as below :

Bind HTML programmatically

The HTML can also be done programmatically.

  • app.component.html
  • app.component.ts


The tutorial source code is available on Github. Download the source

References