0

I have an Angular parent component that makes an API call to obtain HTML content from CMS. But the CMS content has Angular code and needs to access parent scope's variables/events, e.g. this could be HTML need to be inserted into parent HTML template and rendered:

const cmsHTML = "<div (click)="parentFunc()">{{parentVar}}</div>"

Please help with how could I render this from the parent component.

I found that DomSanitizer can insert this HTML but it won't get compiled so everything here shows up as text. ng-content didn't seem to work also. Please help. Thank you!

R. Richards
  • 24,603
  • 10
  • 64
  • 64
Evan
  • 507
  • 2
  • 7
  • 21

0 Answers0