Will HTML templating mechanism works in Angular?

89 Views Asked by At

I am using HTML templating in my Angular app and my code is something like this:

<script type='text/html' id="sampleId">...</script>

But, when the HTML was loaded, I couldn't find this script block in the DOM.

How can I achieve HTML templating mechanism in Angular?

1

There are 1 best solutions below

6
On

Angular don't allow script tag in HTML template. ANgular compiles HTML templates too and removes script tag and other security related things from template. I think you want to inject dynamic HTML in your component. Please describe your use case so that we can provide a better solution of your problem.