Skip to content

Instantly share code, notes, and snippets.

@brakmic
Created March 12, 2017 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brakmic/38b3d3f33039d7ce9667d07e8e52bdd8 to your computer and use it in GitHub Desktop.
Save brakmic/38b3d3f33039d7ce9667d07e8e52bdd8 to your computer and use it in GitHub Desktop.
helper method for script insertion
private appendScript(host: HTMLElement, data: string, index: number) {
this.ngZone.runOutsideAngular(() => {
const script = document.createElement('script');
script.type = 'text/javascript';
script.charset = 'utf-8';
script.id = this.vrScriptPrefix + index;
script.defer = true;
script.async = true;
script.text = data;
host.appendChild(script);
// memorize the script so we can remove it later
this.activeScripts.push(script);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment