Created
March 12, 2017 14:00
-
-
Save brakmic/38b3d3f33039d7ce9667d07e8e52bdd8 to your computer and use it in GitHub Desktop.
helper method for script insertion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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