0

I am planning to build an Angular app that can be really scale. Meaning, it will contains many part that will be develop by different people and will be adding in new part / feature from time to time.

I have read some articles about Angular best practices in naming and folder structure organization, such as:

Angularjs code/naming conventions

AngularJS best practices for module declaration?

Angular - Best practice to structure modules

All of it focuses on folder structure & module naming. But how about the controller & services naming conventions?

For example, if I have a structure like this:

angular.module("myApp",['myApp.groups','myApp.users']);

angular.module("myApp.groups",['myApp.groups.controllers','myApp.groups.directives']);

angular.module("myApp.users",['myApp.users.controllers','myApp.users.directives']);

Should I name controller for myApp.groups.controllers module to be myApp.GroupsController? Or just GroupsController? If just GroupsController, it will be possible conflict of naming if someone else develop another component with controller named GroupsController.

So, what is the best practice for naming controllers & services for huge application that will scale?

Community
  • 1
  • 1
user1995781
  • 19,085
  • 45
  • 135
  • 236

2 Answers2

0

This post by JohnPaPa has a few good explanations. Although some may disagree, but it provides insights and reasons for better understanding.

a diagram from papa

daxeh
  • 1,083
  • 8
  • 12
0

If you want something that will scale, have a look at cg-angular it provides a really good directory structure and has some good generators for everything you would need. As for style guide Google is a great start

Ed Knowles
  • 1,925
  • 1
  • 16
  • 24