So I created a script.service.ts file that I inject my JavaScript files into different components when needed in my project. However I am still facing a issue I had before I created that when I simply just included the script links in the index.html file. That issue is that say you load up a page say called "localhost:4200/user and that uses a component that is using a external JavaScript file to activate the users web cam for example. Everything will work great however if you load up say "localhost:4200/login" and then click a button that routes you to "localhost:4200/user" the camera functionality will not work. I'm just using this functionality as a example of course.
But the main issue is if you load one component first then route to a component that has java script functionality from a external file that functionality will not work unless you start on that component. So how can I force angular to reload functionality for external JavaScript files on route change?
I am using the latest version of Angular. Thank you for the help in advance!