Continuing the discussion from How can I have one file per controller? :
Have you taken a look at organising your application by feature? This is how I organise my application…
<img src=“/uploads/default/173/b779ac0a07364f03.png” width=“177” height=“462”>
Each feature is a self contained angular module.
Take the “myapp.login” feature for example:
angular.module('myapp.login', ['myapp.login.svc'])
.config(function($stateProvider) { ...login only states...})
.controller(function($scope, $state, loginSvc) { ...login only functionality... });
it is a module with controller and config methods. Only this feature’s states are defined in this feature’s config method. The myapp.logic.svc feature is also a module that myapp.login requires.
It makes it sooooo much easier to break down your app and work on discrete pieces of functionality. It also makes it easier to plug in features as and when, or take them out. Separation of concerns is clearly at play!
My app.js file now is the top-level module that “requires” which ever feature it needs.
Hope that A) makes sense, and B) is helpful!
Can you please reinstate the image? It’s a 404 right now if I want to view it, and it does not appear as part of the post. Curious to see how you structure your app. Thanks!