Insert script tags in Angular components

Sometimes you just need to insert 3rd party script tags into Angular Components. It is definitely not very common, and Angular does not make it easy for you. What ever script tag you define your component’s template, will be simply cleared out. Not even a html comment will remain. So I you really need to insert a 3rd party script into your component, you have to do inside the javascript part. It is actually quite simple. You create a script DOM element, set the src or innerHTML or text property and attach it to the DOM via renderer service. // 1. import dependencies import …

Continue Reading