#structure
/global
/components
global
holds components shared by other components, components
are privately scoped components.
#structure per component
/foobar
foobar.module.js
foobar.factory.js
foobar.controller.js
foobar.component.js
foobar.config.js
foobar.run.js
etc...
#naming inside angular's DI
The factory will always be named app.foobar.api
within angular's DI (i.e., it's the name of the internal singleton). The app
prefix helps distinguish between project and vendor components.
When the singleton is injected, just name it api
. It makes the controllers consistent and encourages each controller to have its own private api.
angular
.module('app.foobar', [])
.factory('app.foobar.factory', require('./foobar.factory')
.controller('app.foobar.controller', require('./foobar.controller');
['app.foobar.factory', function(api) {
this.api = api;
}]