Linked Questions

Popular Questions

Dynamically add scripts to my app depending on conditional

Asked by At

I have created a plunker to relate to my question.

I have an app with multiple pages which starts on the login page. When my app first loads it loads index.html which runs a script I have set up called config.js to which then redirects to login.html. This just manages some settings I want to use throughout my app.

In config.js I have set up window.localStorage.setItem("use_minified",true) and I want to use this in login.html to determine to use minified files or not for my application.

I had a look at a couple of questions, such as this one:

Dynamically add script tag with src that may include document.write

Which I have attempted (as you'll see in my plunker) but I am getting the error:

Uncaught Error: [$injector:modulerr] Failed to instantiate module myAppdue to: Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

Related Questions