Hi All,

I have been playing around with AngularJS for learning. I have different 
component which I want to use them as directives so that my app will be 
modular. I am having a hard time to figure out whether I should create each 
module for each directive and finally inject them into main module or I 
just create a single main module and create directives under this.

Please find below sample code
Approach 1:

angular.module('component-1', []).directive('Component1',function(){....});
angular.module('component-2', []).directive('Component2',function(){....});

angular.module('mainApp', ['component-1', 'component-2']);


Approach2:
angular.module('mainApp', [])
    .directive('Component1',function(){....})
    .directive('Component1',function(){....});
    
    
So what are the pros and cons of each approach?
Any help is most appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to