-3

We are getting HTML content from the database by using API call. We are using third party script url.

Example: <div style="height:500px"><script type='text/javascript' src='//www.google.com'></script></div>

We need to display above HTML content into existing angular2 application.

1 Answers1

2

Simply use innerHTML to load dynamic HTML content onto any elements like this -

yourData = <div style="height:500px"><script type='text/javascript' src='//www.google.com'></script></div>

<div [innerHTML]='yourData'></div>

Working Example

this may help you to load dynamic script

Pardeep Jain
  • 84,110
  • 37
  • 165
  • 215