To load JavaScript to angular application create a function like below and invoke this function any one of component life cycle as based on require where user wants to invoke
public loadScript(url) {
console.log('preparing to load...')
let node = document.createElement('script');
node.src = url;
node.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(node);
}
To invoke as
ngOnInit() {
this.loadScript("/assests/test.js")
}