Application file and module organization
Few things are less enjoyable than working on a project where the organization of the application files and modules is garbage, especially if the application is written by people other than you. Keeping your application file tree and module hierarchy clean and tidy will save you and whoever is reading and using your code lots of time in the long run.
Getting ready
Assume that an application you are working on is a generic e-commerce site, with many users who can view and purchase products, leave reviews, and so on.
How to do it…
There are several guidelines that can be followed to yield extremely tight and clean applications that are able to scale without bloating.
One module, one file, and one name
This might seem obvious, but the benefits of following the one module, one file, and one name approach are plentiful:
- Keep only one module per file. A module can be extended in other files in the subfiles and subdirectories as necessary, but
angular.module...