Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am fairly new to Angular.js, and one that confuses me is how to best use modules in an application. It seems to me that modules can contain any of the other common constructs in AngularJS (controllers, directives, filters, services, etc.), but from here I am unsure which module(s) should contain which things.

  • Should I have one module that contains all of the other objects in my application? This seems the easiest to set up, but this smells of the God Object Anti-Pattern to me.

  • Should I divide modules up by types of objects? i.e. one module for controllers, one for directives, etc.?

  • Should I divide them by use? So that all directives, services, and filters that are used for part of the application are together?

  • some other strategy I haven't yet seen / thought of?

Any help would be greatly appreciated.

share|improve this question
    
Not a real answer but you could take a look at angular-seed : github.com/angular/angular-seed might give you some answers you seek. –  KeesDijk May 13 '13 at 17:32
    
This is the best resource I've found regarding module design patterns and angular cliffmeyers.com/blog/2013/4/21/… –  Aaron Cavano May 28 '13 at 0:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.