title: dynamically adding script tags to angular app
body: <p>ZI'm building an app where based on user preferences/configuration, I'll be loading different modules into the page. </p>
  
  <p>To accomplish this, when the page loads, I run a script which builds a list of script-tags and adds all those tags to the body of the page. I also build a dependency injector list, and include the dependencies when the app is loaded. </p>
  
  <p>I'm delaying app load using by putting</p>
  
  <pre>
  window.name = "NG_DEFER_BOOTSTRAP!";
  </pre>
  
  <p>and then after the script tags are added, I run</p>
  
  <pre>
  angular.element(document).ready(function () {
        setTimeout(function(){
            angular.resumeBootstrap();
        },1000);
  });
  </pre>
  
  <p>I have two problems. 
  First of all, for some reason, if I include angular.js in the configuration file, I get errors referring to angular not being found. </p>
  
  <p>I can see that angular is being downloaded to the browser, but I'm guessing it's a timing issue, as angular takes longer to download than many of the other files. </p>
  
  <p>I was going to just put angular in a regular script tag, but then I found that one of the modules I'm loading requires jQuery and jQuery UI, both to be loaded before angular, so that means more files loaded as scripts, and possibly not needed for that user.</p>
  
  <p>I looked at using require.js and passing the config params to </p>
  
  <pre>
  requirejs.config.paths = //the custom built list from the users configuration file
  </pre>
  
  <p>But, from what I understand, that would also mean I'd need to wrap all of my modules in </p>
  
  <pre>
  requirejs(['jquery', 'angular', 'otherModule'],
  function   ($, angular, otherModule) {
      // my module stuff here
  });
  </pre>
  
  <p>Any other suggestions on how to accomplish this? Is there a better AMD than require.js? 
  I'd post all my code here, but I don't think it would help as the problem is coming from the browser downloading the files after the document is ready.</p>