1

I know that I can add custom HTML through TypeScript on this way:

<div class="one" [innerHtml]="htmlToAdd"></div>
this.htmlToAdd = '<div class="two">two</div>';

This work fine, but if I try to add some mat elements(for example mat-card) this not work. All content in mat-card is visible, but the mat-card element is ignored. Why?

When I try this:

this.htmlToAdd = '<mat-card><h1>Hello</h1></mat-card>';

H1 element is printed, but not in the card. Why?

Nemanja Andric
  • 625
  • 11
  • 30

1 Answers1