Im trying to inject a JS in a Angular Component Library(not a app) for this the only solution i found was to create a Injectable class and then in its constructor i have called a method which :
if(typeof google == 'undefined'){
let script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://www.gstatic.com/charts/loader.js';
document.getElementsByTagName('head')[0].appendChild(script);}
And as you can guess, as soon as this runs, the Angular DOMSanitizer runs which i agree is right, but how do i solve this?
Also the Docs of DOMSanitizer hardly point out anything...