I'm developing a web system that needs to load js files dynamically. The reason for this is that there is a necessary logic for selecting which scripts are required, so unnecessary scripts are not loaded.
The problem is that I do not know how to do this. I thought about the RequireJS, but as I'm working with angular, I ended up letting it go, because the only way I found working with AMD using angular was not very natural.
How can I load scripts dynamically? Basically, I thought of an ajax call to a web service url that would be able to select the scripts and return this data, but I do not know how to use it to actually load the scripts.