0

I have a component that uses ng-content

@Component({
    template: `
        <div>
            <ng-content></ng-content>
        </div>`,
    selector: "drop-zone"
})

The ng-content is a template.

<drop-zone>
<script type="text/ng-template">
  <div id="template" class="file-row">
    ...
  </div>
</script>
</drop-zone>

I assume for security reasons, I cannot include text/ng-template script tags in the included code.

I need to provide drop zone with template HTML and providing a script tag of type text/ng-template is how this is typically done.

Is there a workaround for this?

Jim
  • 14,952
  • 15
  • 80
  • 167
  • 2
    Why do you want to include a script dynamically as a template ? – Niladri Feb 17 '18 at 07:48
  • Have you tried [Angular HTML binding](https://stackoverflow.com/q/31548311/8555393)? – Tomas Varga Feb 17 '18 at 10:59
  • @Niladri the template is used by dropzone.js to display file information as the files are dropped. My dropzone component should allow the component consumer to supply his/her own template to the component as they differ in each scenario. – Jim Feb 20 '18 at 05:23

0 Answers0