1

I tried to use DomSanitizer.bypassSecurityTrustHtml, the html content looks as below:

<div>
  <div id="test-div">
    It is a test div element.
  </div>
  <script>
    function changeColor() {
      document.getElementById('test-div').style.background='red';
    }
    changeColor();
  </script>
</div>

Everything works here except the script tag code. Any leads are highly appreciated.

Harpreet
  • 1,527
  • 13
  • 25

0 Answers0