Corner input module after application initialization

Hi everyone, I tried to do this without any luck for a few days.

all the same, some js-scripts (which contain angular modules) are loaded asynchronously and enter them into the running application after its initialization.

Basically, I have a DOM element of the container that will be filled with some HTML code requested from the server, based on this HTML code I will decide which js files (modules) will be needed, and then load them asynchronously to insert modules into the angular app and compile the content using the new injected modules.

I tried, but every time I make a bootstrap method by introducing a module, the main controller starts and erases all my state area .:(

Any help here?

+13
javascript html angularjs
Jun 07 '12 at 1:23
source share
2 answers

This is ugly, but it works: http://jsfiddle.net/MzseV/7/

It basically works by iterating through a member of the _invokeQueue module and applying functions to use the providers used to register services, controllers, and directives (NOTE: they must be written before AFAIK is loaded). This will probably also re-register everything that you previously registered, so you might want some heuristic to select only the ones you want, although I'm not sure if there is any damage when re-registering.

Again, it is rather disgusting and hacked, so I will use it only as a last resort.

This is the question I asked, and later answered about it.

EDIT: Just noticed how old this question is, hopefully it still helps someone.

+3
Aug 21
source share

Maybe this can help?

 app.requires.push("myModule"); 

injection module if you only have access to the module variable

+3
Aug 11 '16 at 8:04 on
source share



All Articles