AngularJS: structuring a web application with multiple ng-apps
- by mg1075
The blogosphere has a number of articles on the topic of AngularJS app structuring guidelines such as these (and others):
http://www.johnpapa.net/angular-app-structuring-guidelines/
http://codingsmackdown.tv/blog/2013/04/19/angularjs-modules-for-great-justice/
http://danorlando.com/angularjs-architecture-understanding-modules/
http://henriquat.re/modularizing-angularjs/modularizing-angular-applications/modularizing-angular-applications.html
However, one scenario I have yet to come across for guidelines and best practices is the case where you have a large web application containing multiple "mini-spa" apps, and the mini-spa apps all share a certain amount of code.
I am not referring to the case of trying to have multiple ng-app declarations on the same page; rather, I mean different sections of a large site that have their own, unique ng-app declaration.
As Scott Allen writes in his OdeToCode blog:
One scenario I haven't found addressed very well is the scenario where
multiple apps exist in the same greater web application and require
some shared code on the client.
Are there any recommended approaches to take, pitfalls to avoid, or good sample structures of this scenario that you can point to?