How to load script file dynamically in app.component.ts(angular)?
问题 I am working in angular2 vs typescript. In my app.component.ts file i have to load the script files on demand based current navigator language. So i have added my function like below(home.component.ts), export class HomeComponent { constructor() { this.loadDynmicallyScript(); } public loadDynmicallyScript() { let node = document.createElement('script'); node.src = "../node_modules/xxxxxxxxxx/xx." + navigator.language"+".min.js"; node.type = 'text/javascript'; document.getElementsByTagName(