javascript - Can I dynamically inject a module into another module? -


assume have 2 modules in 2 separate files:

the first everyone, call myapp:

var myapp = angular.module('myapp', ['dependency.one', 'dependency.one']); 

in file: admin.js have module manages administrative functions.

var myadmin = angular.module('myadmin', ['dependency.three', 'dependency.four']); 

only logged in admin users served admin.js.

is possible inject myadmin module myapp module within admin.js file? alternately, there way include myadmin stuff, if admin.js file linked in page header, or alternative solution not seeing? $inject not appear work in context.

no, not in current (1.x) version of angularjs. when application starts needs provided full set of modules used within application. so, have re-bootstrap whole application take additional modules account.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -