AngularJs - modules must be fully configured before other modules can import them? -


i working on large application, lots of modules depending on other modules. issue may situation module imports module, before imported module configured.

for example:

// -------------------------------------- // create-directives-module.js  // create 'guthub.directives' module angular.module('guthub.directives', []);  // -------------------------------------- // create-main-module.js  // import 'guthub.directives' module right away module 'guthub' angular.module('guthub', ['guthub.directives']);  // -------------------------------------- // create-focus-directive.js  // after 'guthub.directives' has been imported 'guthub',  // add directive 'focus' 'guthub.directives' angular.module('guthub.directives').directive('focus',     function() {     return {         link: function(scope, element, attrs) {                     element[0].focus();             } }; }); 

would 'focus' directive available in 'guthub' module, though has been configured 'guthub.directives' after 'guthub.directives' imported 'guthub'?

when defining modules dependencies, dependencies aren't loaded on spot - declaring them injection later. also, angular doesn't bootstrap until matches ng-app attribute in document after following dom ready event. code should work fine.

demo


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 -