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.