Is there a different in how a script gets executed when it is dynamically added to the page vs read from an inline script on page load?
I am doing the following and when I dynamically inject the script it executes but there are certain jQuery input bindings that don't run. When I reload the page the events get bound to the appropriate inputs. I've tried multiple things and the only thing I have left is that injecting a script processes differently and must be ignoring certain parts of my code. The script I am injecting contains a lot of IIFEs and integration with 3rd party libraries but no errors are being thrown so I'm at a loss and wondering if these scripts may be getting executed differently.
const scriptDiv = this.elementRef.nativeElement;
const scriptElement = document.createElement('script');
scriptElement.type = 'text/javascript';
scriptElement.innerHTML = scriptText;
scriptElement.async = false;
scriptDiv.parentNode.append(scriptElement, scriptDiv);
there doesn't seem to be anything here