How to change the list of currently nested dependencies in angular
1 answer
The list of module dependencies is in the requires
module property.
eg.
var app = angular.module("app", ["dep1"]);
console.log(app.requires);
You can try adding a dependency to this list at runtime. This simple example worked for me.
(function() {
"use strict";
var app1 = angular.module("ag.test", []);
app1.factory("agTestFactory", [function() {
return {
hello: function() {
console.log("hello");
}
};
}]);
var app = angular.module("app", ["app.configurations", "app.routes"]);
app.requires[app.requires.length] = "ag.test";
app.run(["agTestFactory", function(tf) {
tf.hello();
}]);
})();
If that doesn't solve your problem, when can you take a look at this thread. https://groups.google.com/forum/#!topic/angular/w0ZEBz02l8s
+1
source to share