I have loaded script file like below code in angular home.component.ts file
export class HomeComponent {
constructor() {
this.loadDynmicallyScript();
}
public loadDynmicallyScript() {
var script = document.createElement('script');
script.src = "../node_modules/xxxxxx/i18n/xx.min.js";
script.async =false;
document.head.appendChild(script);
}
But this file gets loaded after components created and later. So, in this case, it makes no use of this file. I want to load this file once I appended in documents. How to achieve this?